- rails 4.2.5
- ruby 2.3
I'm using Devise and sending two emails to users.
- after signup (welcome with confirmation link)
- after changing email (with confirmation link)
Both are sent with a custom Devise Mailer:
class UserMailer < Devise::Mailer
layout 'email'
helper :application
include Devise::Controllers::UrlHelpers
def confirmation_instructions(record, token, options={})
if record.pending_reconfirmation?
options[:template_name] = 'confirmation_instructions'
else
options[:template_name] = 'welcome_email'
end
super
end
end
I can preview the Devise default emails whitout problem (confirmation_instructions, reset_password_instructions or unlock_instructions). My question is all about a custom email preview (welcome_email with confirmation_url).
How to preview the welcome_email with confirmation_url in my UserMailerPreview? Is it possible or should I change my aprouch?
My preview so far:
class UserMailerPreview < ActionMailer::Preview
def confirmation_instructions
UserMailer.confirmation_instructions(User.first, '123456', {})
end
end