From dee9795870e038e486ff33fb463b696a323e3a95 Mon Sep 17 00:00:00 2001 From: Kevin Greene Date: Fri, 24 May 2024 16:28:00 -0500 Subject: [PATCH] Removes deprecation warning for Rails 6.1 I'm currently working on removing all deprecation warnings from a Rails 6.1 codebase in preparation for upgrading to Rails 7. I eventually traced the line: ``` DEPRECATION WARNING: action_view.raise_on_missing_translations is deprecated and will be removed in Rails 7.0. Set i18n.raise_on_missing_translations instead. Note that this new setting also affects how missing translations are handled in controllers. ``` to this file. This changes it so folks using Rails 6.1 will no longer see the deprecation warning. --- lib/text_helpers/railtie.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/text_helpers/railtie.rb b/lib/text_helpers/railtie.rb index ba4976c..9f14b27 100644 --- a/lib/text_helpers/railtie.rb +++ b/lib/text_helpers/railtie.rb @@ -65,7 +65,7 @@ def translation_scope initializer "text_helpers.setup_exception_handling", after: 'after_initialize' do next unless config.text_helpers.raise_on_missing_translations - if Rails::VERSION::MAJOR >= 7 + if Rails::VERSION::MAJOR >= 7 || (Rails::VERSION::MAJOR == 6 && Rails::VERSION::MINOR >= 1) if config.respond_to?(:i18n) config.i18n.raise_on_missing_translations = true end