Skip to content

Instantly share code, notes, and snippets.

@vesan
Created August 22, 2013 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vesan/6306123 to your computer and use it in GitHub Desktop.
Save vesan/6306123 to your computer and use it in GitHub Desktop.
Sending emails with different locale than the current user has.
module ActionMailerLocalizationHelpers
def using_locale(locale, &block)
original_locale = I18n.locale
I18n.locale = locale
return_value = yield
I18n.locale = original_locale
return_value
end
end
ActionMailer::Base.send(:include, ActionMailerLocalizationHelpers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment