title: respond_with ArgumentError (Nil location provided. Can't build URI.):
body: <p>I have a controller that responds_with JSON for all of the RESTful actions, index, create, update etc, </p>
  
  <pre><code>class QuestionsController
  
   respond_to :json
  
     def index
       respond_with Question.all
     end
  
  end 
  </code></pre>
  
  <p>However, I also have other actions in the controller. For example, in one method, it checks whether a response was correct and then tries to return a variable with a boolean true or false</p>
  
  <pre><code>respond_with correct_response  #either true or false
  </code></pre>
  
  <p>However, this is giving me the error </p>
  
  <pre><code>ArgumentError (Nil location provided. Can't build URI.):
  </code></pre>
  
  <p>There will also be other methods that I'll wish to respond with multiple values. In Sinatra, you can do this to respond with json</p>
  
  <pre><code>{:word =&gt; session[:word], :correct_guess =&gt; correct_guess, :incorrect_guesses =&gt; session[:incorrect_guesses], :win =&gt; win}.to_json
  </code></pre>
  
  <p>How would I do that in Rails? </p>
  
  <p>So, two questions, what's the proper way to write this</p>
  
  <pre><code>respond_with correct_response
  </code></pre>
  
  <p>and how to respond_with multiple values in a way similar to the example I showed from a Sinatra app.</p>
  
  <p>Thanks for your help.</p>