Non-standard routes in Rails
Posted
by trobrock
on Stack Overflow
See other posts from Stack Overflow
or by trobrock
Published on 2010-05-18T16:45:37Z
Indexed on
2010/05/18
16:51 UTC
Read the original article
Hit count: 438
I currently have a routes.rb file that looks like this:
map.resources :profiles do |profile|
profile.resources :projects, :has_many => :tasks
end
And this gives me routes like this:
/profiles/:profile_id/projects/:project_id/tasks
This is close to what I want, but instead of the '/profiles/:profile_id/' section I want to just have a username in place of that so the route would look something like:
/:profile_user/projects/:project_id/tasks
How can I achieve something like this? I have looked all over and haven't found anything about how to do this, but I also might not have been searching for the right thing.
© Stack Overflow or respective owner