From c90c6c1344e62d5705f92efc323016a83a1e7351 Mon Sep 17 00:00:00 2001 From: Luke Pearce <30228+kule@users.noreply.github.com> Date: Fri, 5 Oct 2018 16:53:28 +0100 Subject: Parameterized mailers can configure delivery job Setting parameterized_delivery_job on a mailer class will cause Parameterized::MessageDelivery to use the specified job instead of ActionMailer::Parameterized::DeliveryJob: class MyMailer < ApplicationMailer self.parameterized_delivery_job = MyCustomDeliveryJob ... end --- actionmailer/lib/action_mailer/base.rb | 1 + actionmailer/lib/action_mailer/parameterized.rb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 02e5ac2a3e..509d859ac3 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -462,6 +462,7 @@ module ActionMailer helper ActionMailer::MailHelper class_attribute :delivery_job, default: ::ActionMailer::DeliveryJob + class_attribute :parameterized_delivery_job, default: ::ActionMailer::Parameterized::DeliveryJob class_attribute :default_params, default: { mime_version: "1.0", charset: "UTF-8", diff --git a/actionmailer/lib/action_mailer/parameterized.rb b/actionmailer/lib/action_mailer/parameterized.rb index 5e768e7106..0fe417affe 100644 --- a/actionmailer/lib/action_mailer/parameterized.rb +++ b/actionmailer/lib/action_mailer/parameterized.rb @@ -140,7 +140,8 @@ module ActionMailer super else args = @mailer_class.name, @action.to_s, delivery_method.to_s, @params, *@args - ActionMailer::Parameterized::DeliveryJob.set(options).perform_later(*args) + job = @mailer_class.parameterized_delivery_job + job.set(options).perform_later(*args) end end end -- cgit v1.2.3