First off, I love inherited_resources
Consider the following:
class Job < ActiveRecord::Base
has_many :inputs, dependent: :destroy
has_one :output
end
class JobsController < InheritedResources::Base
respond_to :json
end
When I request jobs/1.json I just get the JSON of the job object. What I want is also the inputs and output to be included. I normally achieve this by:
job.to_json(include: [:inputs,:output])
My question is what is the best way to achieve this with IR? For now, I'll just overwrite show, but I wanted to know if there was a more elegant way?
Thanks!