How to get full belongs_to object in json render?
ruby, ruby-on-rails
Solution
You might be able to do something like `render :json => @coupons.to_json(:include => :company)`, at least it seems to have worked with my initial testing in rails 2.3.8.
Answer edited to use `:include => :company` rather than `:include => :companies`
Problem
Basically, I have an object that belongs_to :companies, and has the :company_id attribute. When I render json: @coupons, is it possible for the JSON to contain an attribute of its owner rather than the company_id?