diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-05 14:35:50 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-05 14:35:50 -0300 |
commit | d76bf34b044bb79a82a54a646016797760f8ff6e (patch) | |
tree | 39906d2200e14d1b93bd1f22600173a703ebeb8f /actionview/lib/action_view | |
parent | f493a4122ebf44a44b93c02804d33a0e4121d6cd (diff) | |
parent | 4dbce79e95e3f56a9b48992dea4531493a5008cc (diff) | |
download | rails-d76bf34b044bb79a82a54a646016797760f8ff6e.tar.gz rails-d76bf34b044bb79a82a54a646016797760f8ff6e.tar.bz2 rails-d76bf34b044bb79a82a54a646016797760f8ff6e.zip |
Merge pull request #17676 from tigrish/fix_custom_i18n_exception_handler_regression
Fix I18n regression introduced by #13832
Diffstat (limited to 'actionview/lib/action_view')
-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 8324f12a88..342361217c 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -40,12 +40,14 @@ module ActionView remaining_defaults = Array(options.delete(:default)) options[:default] = remaining_defaults.shift if remaining_defaults.first.kind_of? String - # 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 |