Question

I'm using devise for authentication in my app. When a user signs up a confirmation email is sent to the user which says

Welcome user@gmail.com !

You can confirm your account email through the link below:

Confirm my account

But I want to display user's name instead of email. How can I implement this? PLease help. I have devise viewws with me. But it uses an @email instance variable to display email. Where is it defined? Help would be appreciated.

<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>
Was it helpful?

Solution

@resource is likely to be your user.

So replace @email (defined in the devise mailer) with @resource.name (or whatever method you use to get the name)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top