Created
March 5, 2010 15:33
-
-
Save suweller/322820 to your computer and use it in GitHub Desktop.
Suicidal Missing Translation Exceptions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module I18n | |
class SuicidalMissingTranslationData < RuntimeError; end | |
class << self | |
def translate_with_suicidal_exceptions(*args) | |
translate_without_suicidal_exceptions(*args) | |
rescue I18n::MissingTranslationData => e | |
if %w(test cucumber).include? ENV['RAILS_ENV'] | |
raise I18n::SuicidalMissingTranslationData, e | |
elsif %(staging production).include? ENV['RAILS_ENV'] | |
ActiveRecord::Base.logger.error "translation missing '#{e}'" | |
elsif 'development' == ENV['RAILS_ENV'] | |
raise e | |
end | |
end | |
alias_method_chain :translate, :suicidal_exceptions | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment