Forum: Ruby on Rails Including related data in restful results

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Don F. (Guest)
on 2009-04-05 13:29
(Received via mailing list)
I am trying to create a restful XML output for a model but also want
to include the data from a related table. For example, I have a model
called person and the person has multiple photos. I want to include
the url of each photo so that the restful user can then retrieve the
photos if needed.  I know I could create a separate url like person/
123/photos and that would work, but is an additional  query. Either
would include a url of the actual photo photo/987. Again I could also
do person/123/photo/987

Would I be better off to have the one url of person/123 return the
person info along with the photos or separate urls as mentioned above?
Also the pros and cons of the extended photo url

Don F.
This topic is locked and can not be replied to.