My application has some resource types which exist at multiple places
the app. For example, for the discussion model, there are general
discussions, and discussions specific to a particular group.
Things have worked out pretty well so far. My routes are defined as
map.resources :discussions do |d|
map.resources :groups do |g|
g.resources :discussions do |d|
And it doesn’t take much logic in my controller to make things work out.
However, I’m running into a problem with some of the url generators. For
example, discussions_path. Ideally, discussions_path by itself would
generate /discussions, and discussions_path @group would generate
group/@group/discussions. However, discussions_path @group results in an
Is this configuration even supported by rails? Or do I need to bite the
bullet and make two controllers, etc? Any way I could trick the routing
and/or url generators into doing what I want?