# Including related data in restful results

**URL:** <https://www.ruby-forum.com/t/including-related-data-in-restful-results/164756>\
**Category:** Rails\
**Created:** [April 5, 2009, 11:29am UTC](https://www.ruby-forum.com/t/including-related-data-in-restful-results/164756 "2009-04-05T11:29:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Don\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/f04885/32.png) [@Don\_F](https://www.ruby-forum.com/u/Don_F)\
**Post date:** [April 5, 2009, 11:29am UTC](https://www.ruby-forum.com/t/including-related-data-in-restful-results/164756/1 "2009-04-05T11:29:52Z")

</div>

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 F.
