更改设备中的路线

发布于 2024-12-29 12:00:25 字数 535 浏览 6 评论 0原文

我正在使用 ruby​​ 1.9.2、rails 3.1.3、devise 1.5.3,我需要更改设计路线,我已经更改了默认路线,例如登录和注销,但我需要更改其他路由,例如:

http://localhost:3000/password/new

我需要,当用户单击链接时您是否忘记了密码?转到:

http://localhost:3000/recovery_password

在我尝试过的路线中:

get "recovery_password", :to => "devise/passwords#new"                                    
get 'recovery_password' => 'devise_passwords#new', :as => :new_user_password

但不起作用,请帮助。

提前致谢。

Im working with ruby 1.9.2, rails 3.1.3, devise 1.5.3, I need to change the devise routes, I already changed the default routes, like login and logout, but I need to change the others routes, for example:

http://localhost:3000/password/new

I need that, when the user click the link did you forget your password? go to:

http://localhost:3000/recovery_password

in my routes I tried:

get "recovery_password", :to => "devise/passwords#new"                                    
get 'recovery_password' => 'devise_passwords#new', :as => :new_user_password

but don't works, please help.

thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ヤ经典坏疍 2025-01-05 12:00:25

试试这个。它应该有效。 ;)

# change :devise_model to :users, or :admins or any name of your devise model 
devise_for :devise_model do
    get 'recovery_password' => "devise/passwords#new"
end

你可以像这样在视图中使用它。

link_to 'Forgot you password?', recovery_password_url

PS。如果您有定制设备控制器。您应该先告诉路由器,然后将设备控制器更改为您自定义的控制器名称。

try this. It should works. ;)

# change :devise_model to :users, or :admins or any name of your devise model 
devise_for :devise_model do
    get 'recovery_password' => "devise/passwords#new"
end

and you can use this in view like this.

link_to 'Forgot you password?', recovery_password_url

PS. if you have customize devise controller. You should tell the router first, and change devise controller to your customize controller name.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文