I have two questions on routing if any one has some spare time.
1. Is there any way to declare a resource and have its routes use
something other than :id? so that it ends up that /users/:user_name maps
to the show action
2. I noticed when I define a custom rout like
match '/passwords/:user_name/edit'
I don't get any named paths that show up when I run rake routes
Is there any way to say something like
match '/passwords/:user_name/edit', :name => :change_password
I have two questions on routing if any one has some spare time.
Is there any way to declare a resource and have its routes use
something other than :id? so that it ends up that /users/:user_name maps
to the show action
Not that I know of (certainly not mentioned in the Guides or docs.
I noticed when I define a custom rout like
match ‘/passwords/:user_name/edit’
I don’t get any named paths that show up when I run rake routes
Is there any way to say something like
match ‘/passwords/:user_name/edit’, :name => :change_password
Yes, just use :as instead of :name
match ‘/passwords/:user_name/edit’ => ‘password#edit’, :as => :change_password