Deepak Dargade

I'm a Mumbai-based Entrepreneur, Ruby on Rails monomaniac and Food enthusiast.

11 Dec 2011

If the models aren’t associated through active record, then fetching json data is pretty simple in Ruby on Rails.

respond_to do |format|
  format.json  { render :json => @order}
end

If an association does exist, you can pass an :include argument to the render call, like so:

respond_to do |format|
  format.json  { render :json => @order.to_json(:include => [:payments])}
end


Looking for comments?

I don't have comments on this site as they're difficult to manage and take up too much time. I'd rather concentrate on producing content than managing comments.

Since there are no comments, feel free to contact me ✉️ contact me instead.