开发者

resources :users, :as => 'members' equvalent in Rails 3

开发者 https://www.devze.com 2023-01-15 02:34 出处:网络
So in Rails2 you could setup a route like this: resources :users, :as => \'members\' This way you st开发者_StackOverflow社区ill have your users_path but it matches /members

So in Rails2 you could setup a route like this:

resources :users, :as => 'members'

This way you st开发者_StackOverflow社区ill have your users_path but it matches /members

Now, how do you go about doing this in Rails3? :as parameter here means totally different thing and I can't find what makes it work as before.


I think what you're looking for is the :path option:

resources :users, :path => 'members'

Tested it on my app and the users_path still works, but matches /members as required. It doesn't match /users.

0

精彩评论

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