diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-07-05 22:43:36 +0200 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-07-05 22:43:36 +0200 |
commit | f2a8c23654d69dd8f294971487b5abf0e5d891c3 (patch) | |
tree | 3142d38731d20bd5f9dbe02d855e6c7e4b63cea5 /actionmailer/lib | |
parent | 3046c9bbe154aa717a5147091be8b495ed8969c4 (diff) | |
parent | ca2387eb0145c0b8639f06ac7acb642fb3755c72 (diff) | |
download | rails-f2a8c23654d69dd8f294971487b5abf0e5d891c3.tar.gz rails-f2a8c23654d69dd8f294971487b5abf0e5d891c3.tar.bz2 rails-f2a8c23654d69dd8f294971487b5abf0e5d891c3.zip |
Merge pull request #20758 from xijo/action_mailer_message_delivery_respects_i18n_locale
ActionMailer::MessageDelivery respects current I18n.locale
Diffstat (limited to 'actionmailer/lib')
-rw-r--r-- | actionmailer/lib/action_mailer/delivery_job.rb | 6 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/message_delivery.rb | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/actionmailer/lib/action_mailer/delivery_job.rb b/actionmailer/lib/action_mailer/delivery_job.rb index 52772af2d3..f008671a72 100644 --- a/actionmailer/lib/action_mailer/delivery_job.rb +++ b/actionmailer/lib/action_mailer/delivery_job.rb @@ -6,8 +6,10 @@ module ActionMailer class DeliveryJob < ActiveJob::Base # :nodoc: 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) + def perform(mailer, mail_method, delivery_method, locale, *args) #:nodoc: + I18n.with_locale(locale) do + mailer.constantize.public_send(mail_method, *args).send(delivery_method) + end end end end diff --git a/actionmailer/lib/action_mailer/message_delivery.rb b/actionmailer/lib/action_mailer/message_delivery.rb index ff2cb0fd01..c2479bf651 100644 --- a/actionmailer/lib/action_mailer/message_delivery.rb +++ b/actionmailer/lib/action_mailer/message_delivery.rb @@ -87,7 +87,7 @@ module ActionMailer private def enqueue_delivery(delivery_method, options={}) - args = @mailer.name, @mail_method.to_s, delivery_method.to_s, *@args + args = @mailer.name, @mail_method.to_s, delivery_method.to_s, I18n.locale.to_s, *@args ActionMailer::DeliveryJob.set(options).perform_later(*args) end end |