diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-01-31 08:21:22 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-01-31 08:31:44 +1100 |
commit | 6df81c66932773b4a461816c9cd6b85cf7157776 (patch) | |
tree | 88c2ba867afab54251bc8a33136ec05a17c6b940 /app/models | |
parent | 26c9c6a3f0f5bb33fa52841d5854bf52b7cf2e20 (diff) | |
parent | afa9ef14323dfbfd412f0c8872e0b3736d60e7a3 (diff) |
Merge branch 'i18n_rails3_preparation' into rails-3-spike
Conflicts:
Gemfile.lock
app/controllers/general_controller.rb
app/controllers/public_body_controller.rb
spec/controllers/public_body_controller_spec.rb
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/track_mailer.rb | 7 | ||||
-rw-r--r-- | app/models/user.rb | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/app/models/track_mailer.rb b/app/models/track_mailer.rb index 7dfa87f52..03310478a 100644 --- a/app/models/track_mailer.rb +++ b/app/models/track_mailer.rb @@ -91,10 +91,9 @@ class TrackMailer < ApplicationMailer if email_about_things.size > 0 # Send the email - previous_locale = I18n.locale - I18n.locale = user.get_locale - TrackMailer.deliver_event_digest(user, email_about_things) - I18n.locale = previous_locale + I18n.with_locale(user.get_locale) do + TrackMailer.deliver_event_digest(user, email_about_things) + end end # Record that we've now sent those alerts to that user diff --git a/app/models/user.rb b/app/models/user.rb index 490587c39..bc04b5449 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -90,12 +90,7 @@ class User < ActiveRecord::Base end def get_locale - if !self.locale.nil? - locale = self.locale - else - locale = I18n.locale - end - return locale.to_s + (self.locale || I18n.locale).to_s end def visible_comments |