aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbdelkader Boudih <terminale@gmail.com>2015-02-19 14:23:02 +0000
committerAbdelkader Boudih <terminale@gmail.com>2015-02-19 14:23:02 +0000
commit0b09261af50b1fa6e7fcee534ca2bc0073945517 (patch)
tree1b0bfb70aa929d1e5823f8fec4708c51e8a631d5
parent259d33db8cae4f139c4646077f1637a8224dfdb2 (diff)
parentc2f59f37c678bf5d8caaf3fa292be0871214ba93 (diff)
downloadrails-0b09261af50b1fa6e7fcee534ca2bc0073945517.tar.gz
rails-0b09261af50b1fa6e7fcee534ca2bc0073945517.tar.bz2
rails-0b09261af50b1fa6e7fcee534ca2bc0073945517.zip
Merge pull request #19002 from bdewater/patch-1
Fix code sample for custom exception handler to match text [ci skip]
-rw-r--r--guides/source/i18n.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/i18n.md b/guides/source/i18n.md
index 9b049ea8b8..4dc4c5a660 100644
--- a/guides/source/i18n.md
+++ b/guides/source/i18n.md
@@ -1030,7 +1030,7 @@ In other contexts you might want to change this behavior, though. E.g. the defau
module I18n
class JustRaiseExceptionHandler < ExceptionHandler
def call(exception, locale, key, options)
- if exception.is_a?(MissingTranslation)
+ if exception.is_a?(MissingTranslationData)
raise exception.to_exception
else
super
@@ -1047,7 +1047,7 @@ This would re-raise only the `MissingTranslationData` exception, passing all oth
However, if you are using `I18n::Backend::Pluralization` this handler will also raise `I18n::MissingTranslationData: translation missing: en.i18n.plural.rule` exception that should normally be ignored to fall back to the default pluralization rule for English locale. To avoid this you may use additional check for translation key:
```ruby
-if exception.is_a?(MissingTranslation) && key.to_s != 'i18n.plural.rule'
+if exception.is_a?(MissingTranslationData) && key.to_s != 'i18n.plural.rule'
raise exception.to_exception
else
super