In Rails 4.2.0, I am using the Devise gem for authentication - devise 3.4.1
.
The confirmation email is sent as soon as a user is created. We need to skip this confirmation email and send a custom email with the confirmation link. Please help me to solve this issue.
:confirmable
is used in the User model.
You can try this
@user.skip_confirmation! @user.save
Call skip_confirmation!
before saving the user record.
To skip the confirmation notification only you can use skip_confirmation_notification!
@user.skip_confirmation_notification! @user.save
Hope this helps!
In Addition
if you wish to skip confirmation on the same line without creating a variable and you do not need to confirm that particular User, for example in seeds.rb
:
User.create(email: "#{role_name}@example.com", password: 'password', password_confirmation: 'password', confirmed_at: Time.now.utc, # skip confirmation)
or
If you just want to override the default email template, then you can run
rails generate devise:views -v registrations confirmations
It will generate the default views for confirmations then you can override it according to your need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With