开发者

rails 3 route alias

开发者 https://www.devze.com 2023-02-15 11:53 出处:网络
In older version 2.x I was doing something like: map.resources :jobs, :as => \'vagas\' and this way, I can use jobs_path to create a link to.

In older version 2.x I was doing something like:

map.resources :jobs, :as => 'vagas'

and this way, I can use jobs_path to create a link to.

But in rails 3, I still can use :as to define an alias, but I cannot use jobs_path anymore, because it forces me to use vagas_path.

So I was wondering if have any way to define an alias and still use the original 开发者_StackOverflow中文版resource name to create a link.


resources :jobs, :path => 'vagas'  # after the original!


'map' is in Rails 2.x

You should:

resources :jobs, :path => :vagas
0

精彩评论

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