修改设计邮件

Raj*_*ngh 1 ruby-on-rails actionmailer devise devise-confirmable ruby-on-rails-4

我在我的应用程序中使用devise进行身份验证。当用户注册时,会向该用户发送一封确认电子邮件,其中显示

Welcome user@gmail.com !

You can confirm your account email through the link below:

Confirm my account
Run Code Online (Sandbox Code Playgroud)

但是我想显示用户名而不是电子邮件。我该如何实施?请帮忙。我和我一起设计了viewws。但是它使用@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>
Run Code Online (Sandbox Code Playgroud)

apn*_*ing 5

@resource 可能是您的用户。

因此,将@email(在devise邮件程序中定义)替换为@resource.name(或用于获取名称的任何方法)