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

查看:17
本文介绍了自定义Devise中的confirmation_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) %>

并得到了这个不错的链接:

And got this nice link:

http://localhost:3000/confirm/RjOnrd5yNREEDwsEfiFa

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

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