Forum: Ruby on Rails Including related data in restful results

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6d465bb8df6bda89904c7aafea0dda6c?d=identicon&s=25 Don French (Guest)
on 2009-04-05 11: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

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