Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save knoopx/7448220 to your computer and use it in GitHub Desktop.
Save knoopx/7448220 to your computer and use it in GitHub Desktop.
I18n.exception_handler = SimpleExceptionHandler
class SimpleExceptionHandler < I18n::ExceptionHandler
def self.call(exception, locale, key, options)
if exception.is_a?(I18n::MissingTranslation)
exception.keys.last.to_s.gsub('_', ' ').gsub(/\b('?[a-z])/) { $1.capitalize }
else
super
end
end
end
I18n.exception_handler = SimpleExceptionHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment