diff options
author | Christopher Dell <chris@tigrish.com> | 2014-11-19 15:08:56 +0100 |
---|---|---|
committer | Christopher Dell <chris@tigrish.com> | 2014-11-19 16:33:50 +0100 |
commit | 4dbce79e95e3f56a9b48992dea4531493a5008cc (patch) | |
tree | 3954894ff4ff66ec601de9f45290495e395def30 /actionview/lib | |
parent | 52fddcc653458456f98b3683dffd781cf00b35fe (diff) | |
download | rails-4dbce79e95e3f56a9b48992dea4531493a5008cc.tar.gz rails-4dbce79e95e3f56a9b48992dea4531493a5008cc.tar.bz2 rails-4dbce79e95e3f56a9b48992dea4531493a5008cc.zip |
Fix I18n regression introduced by #13832
Previously, when the `:raise` options was set to `false`, it would get overwritten to `true`, preventing custom exception handlers to be used.
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/translation_helper.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index c2fda42396..c691aa0acb 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -39,12 +39,14 @@ module ActionView options = options.dup options[:default] = wrap_translate_defaults(options[:default]) if options[:default] - # If the user has specified rescue_format then pass it all through, otherwise use - # raise and do the work ourselves - options[:raise] ||= ActionView::Base.raise_on_missing_translations - - raise_error = options[:raise] || options.key?(:rescue_format) - unless raise_error + # If the user has explicitly decided to NOT raise errors, pass that option to I18n. + # Otherwise, tell I18n to raise an exception, which we rescue further in this method. + # Note: `raise_error` refers to us re-raising the error in this method. I18n is forced to raise by default. + if options[:raise] == false || (options.key?(:rescue_format) && options[:rescue_format].nil?) + raise_error = false + options[:raise] = false + else + raise_error = options[:raise] || options[:rescue_format] || ActionView::Base.raise_on_missing_translations options[:raise] = true end |