Sha256: 0cd7c255f323fafb828036ecd99bee1d16c3cef0e764afe0263c0744a61b3234

Contents?: true

Size: 925 Bytes

Versions: 3

Compression:

Stored size: 925 Bytes

Contents

require 'action_mailer'

##
# Adds sending email through an ActiveRecord table as a delivery method for
# ActionMailer.
#

class ActionMailer::ARMailer < ActionMailer::Base

  def self.inherited(sub)
    logger.warn('The ActionMailer::ARMailer class has been deprecated. Will be removed in version 2.1. Just use ActionMailer::Base.')
  end

end

class ActionMailer::Base

  @@email_class = Email

  ##
  # Current email class for deliveries.

  def self.email_class
    @@email_class
  end

  ##
  # Sets the email class for deliveries.

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

  ##
  # Adds +mail+ to the Email table.  Only the first From address for +mail+ is
  # used.

  def perform_delivery_activerecord(mail)
    mail.destinations.each do |destination|
      @@email_class.create :mail => mail.encoded, :to => destination,
                           :from => mail.from.first
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
adzap-ar_mailer-2.0.0 lib/action_mailer/ar_mailer.rb
brunoaalves-ar_mailer-2.0.0 lib/action_mailer/ar_mailer.rb
brunoaalves-ar_mailer-2.0.1 lib/action_mailer/ar_mailer.rb