Class: ActionMailer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/action_mailer/cached_mailer.rb

Constant Summary collapse

@@cache_content =
false
@@email_class_name =
'Email'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.email_classObject



12
13
14
# File 'lib/action_mailer/cached_mailer.rb', line 12

def self.email_class
  @@email_class_name.constantize
end

.email_class=(klass) ⇒ Object



8
9
10
# File 'lib/action_mailer/cached_mailer.rb', line 8

def self.email_class=(klass)
  @@email_class_name = klass.to_s
end

Instance Method Details

#deliver_with_cache!(mail = @mail) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/action_mailer/cached_mailer.rb', line 16

def deliver_with_cache!(mail = @mail)
  mail.destinations.each do |destination|
    mail_attributes = {:to => destination, :from => mail.from.first, :template => @template, :mailer => self.class.to_s}
    mail_attributes.merge!(:mail => mail.encoded) if cache_content
    self.class.email_class.create mail_attributes
  end
  deliver_without_cache!
end