Created
July 1, 2015 00:27
-
-
Save Sija/ace2efa3aedba9292528 to your computer and use it in GitHub Desktop.
Make Rails' 4.2 ActionMailer locale aware or i18n for ya emailz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActionMailer | |
| class MessageDelivery | |
| private | |
| def enqueue_delivery(delivery_method, options={}) | |
| 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 | |
| class DeliveryJob | |
| 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed in rails/rails#20800