title: Add nested fields in JSON output in Rails controller
body: <p>At the end of a standard Rails controller there is:</p>
  
  <pre><code>respond_to do |format|
    format.html
    format.json { render json: @cars }
  end
  </code></pre>
  
  <p>Works as expected. Except the JSON doesn't have the associations of <code>@cars</code>:</p>
  
  <pre><code>class Car &lt; ActiveRecord::Base
    attr_accessible :model, :color
    belongs_to :manufacturer
  end
  </code></pre>
  
  <p>The JSON doesn't have the fields of the manufacturer. How do I get the JSON to have those? Is there something I add to the <code>belongs_to</code> call? Is there a way I can add it to the object created from <code>format.json</code>?</p>