Skip to content

Instantly share code, notes, and snippets.

@lalitlogical
lalitlogical / custom_devise_mailer.rb
Last active March 21, 2017 07:48
Dynamic subject for Devise mailers (i.e. reset_password_instructions)
class CustomDeviseMailer < Devise::Mailer
helper :application # gives access to all helpers defined within `application_helper`.
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
default template_path: 'devise/mailer' # to make sure that your mailer uses the devise views
def reset_password_instructions(record, token, opts={})
opts[:subject] = I18n.t(:'devise.mailer.reset_password_instructions.subject', app_name: ENV['APP_NAME'])
super
end
end