开发者

Adding custom route to routes file Rails 2

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜