开发者

Adding custom route to routes file Rails 2

开发者 https://www.devze.com 2023-03-13 17:22 出处:网络
I want to be able to do the following: change_pass_user_path(usuario) in a \"link_to\" (for example). where \"change_pass\" is the name of my action inside de \"user\" controller.

I want to be able to do the following:

change_pass_user_path(usuario)

in a "link_to" (for example).

where "change_pass" is the name of my action inside de "user" controller.

I already added this:

map.resources :users

to my routes file. (so I'm already able to do things like: edit_user_path)

I already tried:

map.resources :users do
    get 'change_pass'
  end

but it returns t开发者_Python百科his error:

undefined method `get' for main:Object (NoMethodError)

How can I do that?

Thx


Try this,

map.resources :users, :member => { :change_pass => :get }
0

精彩评论

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