aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-03 13:25:32 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-06-03 13:25:32 -0300
commitcecbf9ed32ab19d34ecae278f247a552d853b329 (patch)
tree00785309704d9df03c02ecd5041854c98fed2761 /actionmailer/lib/action_mailer
parent6c4416183454cc75ee4dbed107fe7370c69fc37d (diff)
parentf5a131aaeaf0533e5f81461c2ad63474a865c19c (diff)
downloadrails-cecbf9ed32ab19d34ecae278f247a552d853b329.tar.gz
rails-cecbf9ed32ab19d34ecae278f247a552d853b329.tar.bz2
rails-cecbf9ed32ab19d34ecae278f247a552d853b329.zip
Merge pull request #18587 from chrismcg/allow_deliver_later_queue_name_to_be_configured
Allow configuration of ActionMailer queue name
Diffstat (limited to 'actionmailer/lib/action_mailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb2
-rw-r--r--actionmailer/lib/action_mailer/delivery_job.rb2
-rw-r--r--actionmailer/lib/action_mailer/delivery_methods.rb3
3 files changed, 6 insertions, 1 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 4a5229fe18..3c522ce707 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -413,6 +413,8 @@ module ActionMailer
#
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with
# <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
+ #
+ # * <tt>deliver_later_queue_name</tt> - The name of the queue used with <tt>deliver_later</tt>
class Base < AbstractController::Base
include DeliveryMethods
include Previews
diff --git a/actionmailer/lib/action_mailer/delivery_job.rb b/actionmailer/lib/action_mailer/delivery_job.rb
index e864ab7a4d..52772af2d3 100644
--- a/actionmailer/lib/action_mailer/delivery_job.rb
+++ b/actionmailer/lib/action_mailer/delivery_job.rb
@@ -4,7 +4,7 @@ module ActionMailer
# The <tt>ActionMailer::DeliveryJob</tt> class is used when you
# want to send emails outside of the request-response cycle.
class DeliveryJob < ActiveJob::Base # :nodoc:
- queue_as :mailers
+ queue_as { ActionMailer::Base.deliver_later_queue_name }
def perform(mailer, mail_method, delivery_method, *args) #:nodoc:
mailer.constantize.public_send(mail_method, *args).send(delivery_method)
diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb
index aedcd81e52..4758b55a2a 100644
--- a/actionmailer/lib/action_mailer/delivery_methods.rb
+++ b/actionmailer/lib/action_mailer/delivery_methods.rb
@@ -16,6 +16,9 @@ module ActionMailer
cattr_accessor :perform_deliveries
self.perform_deliveries = true
+ cattr_accessor :deliver_later_queue_name
+ self.deliver_later_queue_name = :mailers
+
self.delivery_methods = {}.freeze
self.delivery_method = :smtp