在Devise中自定义confirm_url [英] Customizing the confirmation_url in Devise

查看:126
本文介绍了在Devise中自定义confirm_url的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在邮件视图中自定义由Devise生成的默认行?

How do you customize this default line generated by Devise in the mailer view?

<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>

我在控制器中编写了一个名为 user_confirm 。而且我也为它定了一条路线。我可以通过令牌作为参数获取链接到该方法的URL吗?

I've written a method in my controller called user_confirm. And I have also defined a route for it. Can I get the URL to link to that method with token as the params?

推荐答案

我使用此路由:

map.user_confirm 'confirm/:confirmation_token',
    :controller => 'confirmations', :action => 'show'

而这个ERB:

<%= link_to 'Confirm my account',
    user_confirm_url(:confirmation_token => @resource.confirmation_token) %>

得到这个好的链接:

http://localhost:3000/confirm/RjOnrd5yNREEDwsEfiFa

这篇关于在Devise中自定义confirm_url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆