我在我的应用中使用设计进行身份验证。当用户注册确认电子邮件时,会向用户发送
Welcome user@gmail.com !
You can confirm your account email through the link below:
Confirm my account
但我想显示用户名而不是电子邮件。我该如何实现呢?请帮忙。我和我一起设计了视图。但它使用@email
实例变量来显示电子邮件。它在哪里定义?帮助将不胜感激。
<p>Welcome <%= @email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @token) %></p>
答案 0 :(得分:4)
@resource
很可能是您的用户。
所以用@email
(或者你用来获取名字的任何方法)替换@resource.name
(在设计邮件程序中定义)