Allow parent_mailer to be customizable via Devise.parent_mailer, useful for engines

This commit is contained in:
Jay Shepherd 2013-01-18 02:26:41 -06:00
parent 6c2f51e35e
commit cc017b1f0d
2 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,4 @@
class Devise::Mailer < ::ActionMailer::Base
class Devise::Mailer < Devise.parent_mailer.constantize
include Devise::Mailers::Helpers
def confirmation_instructions(record, opts={})

View File

@ -199,6 +199,12 @@ module Devise
mattr_accessor :parent_controller
@@parent_controller = "ApplicationController"
# The parent mailer all Devise mailers inherit from.
# Defaults to ActionMailer::Base. This should be set early
# in the initialization process and should be set to a string.
mattr_accessor :parent_mailer
@@parent_mailer = "ActionMailer::Base"
# The router Devise should use to generate routes. Defaults
# to :main_app. Should be overriden by engines in order
# to provide custom routes.