Nested resource without an explicit has_many relationship

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs