Changing the id parameter in Rails routing

Posted by japancheese on Stack Overflow See other posts from Stack Overflow or by japancheese
Published on 2010-05-14T19:44:05Z Indexed on 2010/05/14 20:54 UTC
Read the original article Hit count: 284

Hello, Using rails3 new routing system, is it possible to change the default :id parameter

resources :users, :key => :username

come out with the following routes

/users/new
/users/:username
/users/:username/edit
...etc

I'm asking because although the above example is simple, it would be really helpful to do in a current project I'm working on.

Is it possible to change this parameter, and if not, is there a particular reason as to why not?

© Stack Overflow or respective owner

Related posts about ruby-on-rails3

Related posts about routing