# Nested resource without an explicit has\_many relationship

**URL:** <https://www.ruby-forum.com/t/nested-resource-without-an-explicit-has-many-relationship/136072>\
**Category:** Rails\
**Created:** [April 28, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/nested-resource-without-an-explicit-has-many-relationship/136072 "2008-04-28T17:59:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![schof](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@schof](https://www.ruby-forum.com/u/schof)\
**Post date:** [April 28, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/nested-resource-without-an-explicit-has-many-relationship/136072/1 "2008-04-28T17:59:11Z")

</div>

I’m interested in showing the usages for a particular project, yet  
there is no direct relationship between project and usages.

Project has\_many :requests  
Request has\_many :options  
Options belongs\_to :asset  
Asset has\_many :usages

My thinking is I should add a “usages and usages=” method to my  
project model. Then I can define the following route.

map.resources :projects, :has\_many =\> [:requests, :usages]

Does this approach make any sense? Any other suggestions?

TIA,

Sean

---

<div class="post-metadata">

**Author:** ![schof](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/8dc957/32.png) [@schof](https://www.ruby-forum.com/u/schof)\
**Post date:** [April 28, 2008, 7:09pm UTC](https://www.ruby-forum.com/t/nested-resource-without-an-explicit-has-many-relationship/136072/2 "2008-04-28T19:09:25Z")

</div>

I settled on has\_many with the :finder\_sql option. This seems to work  
well enough but I’m curious to hear if anyone has a better idea.
