Sha256: 4c05ca5f6b1798d3417338e563196c10a9884be3066688e51c487fa6da50dc1c

Contents?: true

Size: 880 Bytes

Versions: 18

Compression:

Stored size: 880 Bytes

Contents

# Rails 3.2.16 and 4.0.2 introduced a fix for CVE-2013-4491 :
# https://github.com/rails/rails/commit/78790e4bceedc632cb40f9597792d7e27234138a
#
# This fix introduces a :raise option to the :translate helper, which
# defines wether an exception shall be raised (:raise => true) or delegated
# to I18n.exception_handler (:raise => false).
#
# This monkey patch forces :raise to `false`, to force use of Localeapp::ExceptionHandler
#
# NB: the CVE-2013-4491 fix also introduced a regression which is fixed in:
#     https://github.com/rails/rails/commit/31a485fa5a843a766c4b889ee88a6c590a3a6ebb


module Localeapp
  module ForceExceptionHandlerInTranslationHelper
    def translate(key, options = {})
      super(key, {:raise => false}.merge(options))
    end
    alias :t :translate
  end
end

ActionView::Base.send(:include, ::Localeapp::ForceExceptionHandlerInTranslationHelper)

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
localeapp-2.4.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-2.3.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-2.2.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-2.1.1 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-2.1.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-2.0.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-1.0.2 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-1.0.1 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-1.0.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.9.3 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.9.2 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.9.1 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.9.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.8.1 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.8.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.7.2 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.7.1 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb
localeapp-0.7.0 lib/localeapp/rails/force_exception_handler_in_translation_helper.rb