开发者

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

开发者 https://www.devze.com 2023-01-23 22:32 出处:网络
My routes.rb look like this: #... map.resources :users map.root :controller => \"main\"开发者_开发知识库

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

精彩评论

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

关注公众号