title: Rails JSON multiple nested associations
body: <p>I have a list of objects, tests, which contain questions and bonus questions, each of which has a subject model. I'm trying to include all of them in a JSON API but I keep getting odd incomprehensible syntax error messages. I can get it working with questions and subject or bonus questions and subjects, but not both. Here is what I have now:</p>
  
  <pre><code>render json: tests.as_json(:include =&gt; {:questions =&gt;{:include =&gt; {:subject}},:bonuses =&gt; {:include =&gt; {:subject}}})
  </code></pre>
  
  <p>The error message I get is </p>
  
  <p>/app/controllers/test_controller.rb:49: syntax error, unexpected '}', expecting => ...ssups =>{:include => {:subject}},:bonuses => {:include => {:... ... ^ /app/controllers/question_set_controller.rb:49: syntax error, unexpected '}', expecting => ...uses => {:include => {:subject}}}) ... ^ /app/controllers/question_set_controller.rb:76: syntax error, unexpected end-of-input, expecting keyword_end</p>
  
  <p>Thanks in advance.</p>