I have a users controller in my application, routed with:
map.resources :users
This has my user pages living at /users/1, and so forth.
I’d like my user pages to live at /users/blake, etc.
What’s the right way to do this in rails, such that I can say link_to(@user) and the correct path is generated?
In model:
In controller:
to_paramin model is used by ActionPack to construct url for this object. And in controller you need to fetch your model by this field.