Module: Incline::Extensions::ActionMailerBase

Defined in:
lib/incline/extensions/action_mailer_base.rb

Overview

Adds the default_hostname, default_sender, and default_recipient methods to the ApplicationMailer::Base class.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Sets the default from and to address according to the configuration.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/incline/extensions/action_mailer_base.rb', line 33

def self.included(base)
  base.extend ClassMethods

  class << self

    private

    if method_defined?(:inherited)
      alias_method :incline_original_inherited, :inherited
    else
      def incline_original_inherited(subclass)
        # Do nothing.
      end
    end

    def inherited(subclass)
      incline_original_inherited subclass

      default(
          {
              from: default_sender,
              to: default_recipient
          }
      )
    end
  end

end