Deepak Dargade.

I'm a Mumbai-based Entrepreneur, Ruby on Rails monomaniac and Food enthusiast.
Best known for turning ideas into reality and Co-founder of Classpro.

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