开发者

How to map users in root URL in Rails 2.x routes?

My routes.rb look like this:

#...
map.resources :users
map.root :controller => "main"开发者_开发知识库
#...

My app user's profiles are something like:

http://www.railsapp.com/users/3

I would like to change it to:

http://www.railsapp.com/3

Or even:

http://www.railsapp.com/username

How Rails 2.x router handles this situation?


Checkout some previous answers for 'vanity' urls:

How can I implement vanity URL's in a Rails application?

How to implement "short" nested vanity urls in rails?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜