title: How do you output JSON from Ruby on Rails?
body: <p>I'm looking to have a model that gets created / updated via AJAX.  How do you do this in Ruby on Rails?</p>
  
  <p>Also, more specifically: how do you output JSON in RoR?</p>
  
  <pre><code>def create
    response = {:success =&gt; false}
    @source = Source.new(params[:source])
    if @source.save
      response.success = true
    end
    render :json =&gt; response.to_json
  end
  </code></pre>