I have Users, Bands and Codes
Bands have many Codes, Users have many codes, but Users and Bands don’t have any relationship.
Bands have many codes because users create codes that are related to a band. There may be many bands for which a user has codes for…
I guess a user could have a band but I do not want my urls to be users/:id/bands/:id/codes/:id
Ideas?
EDIT: I just noticed that your question says you do not want that url. My answer is the reverse, sorry.
If that’s what want your url to be, then you should definitely make Users have many Bands, and Bands have many Codes. Then use a
has_many :thoughto make Users have many Codes. Like this:Then set up your routes using nested resources:
That would make
code_path(1, 2, 3)map to/users/1/bands/2/codes/3. And yourCodesController#showaction would have access touser_id(1),band_id(2), andid(3).