Part 1.
I have a Series which has_many :articles. In my show action, if xml is requested, I’d like to include all the associated :articles, but I really only want three of the fields: :title, :date, and :id
How can I do this?
Part 2.
Instead of doing this from the controller, I wonder if it would be better just to override to_xml in my model. Is this good practice? How would I do this?
Thanks so much!
Edit
Sector was almost right, but it needs to be a hash:
render :xml => @series.to_xml(:include => { :articles => { :only => [:title, :date, :id] } })
Part 1
Part 2
Controller is good place for this