Sha256: 02a47274e9e4cbbbffea2a5e1ee88aa531c464605cf3f67a1ddcf87605f71be1
Contents?: true
Size: 1.06 KB
Versions: 28
Compression:
Stored size: 1.06 KB
Contents
require 'active_job' module ActionMailer # The <tt>ActionMailer::DeliveryJob</tt> class is used when you # want to send emails outside of the request-response cycle. # # Exceptions are rescued and handled by the mailer class. class DeliveryJob < ActiveJob::Base # :nodoc: queue_as { ActionMailer::Base.deliver_later_queue_name } rescue_from StandardError, with: :handle_exception_with_mailer_class def perform(mailer, mail_method, delivery_method, *args) #:nodoc: mailer.constantize.public_send(mail_method, *args).send(delivery_method) end private # "Deserialize" the mailer class name by hand in case another argument # (like a Global ID reference) raised DeserializationError. def mailer_class if mailer = Array(@serialized_arguments).first || Array(arguments).first mailer.constantize end end def handle_exception_with_mailer_class(exception) if klass = mailer_class klass.handle_exception exception else raise exception end end end end
Version data entries
28 entries across 28 versions & 4 rubygems