I’m not sure if this has been answered before but I couldn’t find
anything in the few searches I did before posting.
Anyway, here is what I’m trying to do:
I have 3 resources: One, Two, and Three
map.resources :ones do |ones|
ones.resources :threes, :name_prefix => “one_”
map.resources :twos do |twos|
twos.resources :threes, :name_prefix => “two_”
Now, in my controllers and views, I can access the following three
sets of URL helpers (or named routes):
Now my question is how do cleanly determine which path method to
What I’ve done is defined in my Three controller a method called
“determine_threes_path” and it looks like this:
and path_method_prefix is a method that determines the value “one_”,
“two_”, or “” depending on the values in the params hash.
I’ve done this for all the path methods that I need and then defined
them all as helper methods so they are accessible in the view as well.
Is there an existing solution to this problem or does anyone have any
suggestions on how I can do this in a more structured fashion?
Thank you in advanced for any help anyone can provide.