Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update Missing to handle throw/catch for compatibility with i18n 0.6.0

  • Loading branch information...
commit d3aca96b6a0ab52d1af9af14c1eff7326e6cbbef 1 parent b631b05
@ppg ppg authored
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/i18n/backend/active_record/missing.rb
View
10 lib/i18n/backend/active_record/missing.rb
@@ -54,7 +54,15 @@ def store_default_translation(locale, key, interpolations)
end
def translate(locale, key, options = {})
- super
+ # Support throw/catch for MissingTranslation (i18n 0.6.0)
+ result = catch(:exception) do
+ super
+ end
+ if result.is_a?(I18n::MissingTranslation)
+ self.store_default_translations(locale, key, options)
+ throw(:exception, result)
+ end
+ result
rescue I18n::MissingTranslationData => e
self.store_default_translations(locale, key, options)
raise e
Please sign in to comment.
Something went wrong with that request. Please try again.