From a2478824a58ba40f2bd9b7956f305463c9b056c6 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Wed, 8 Jun 2022 08:54:06 -0700 Subject: [PATCH] Rename I18n::Backend::ActiveRecord::Translation#to_hash to #to_h to avoid problems with ruby2_keywords and Rails 7 --- lib/i18n/backend/active_record.rb | 2 +- lib/i18n/backend/active_record/translation.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/i18n/backend/active_record.rb b/lib/i18n/backend/active_record.rb index 4d2bcbd..e9024ec 100644 --- a/lib/i18n/backend/active_record.rb +++ b/lib/i18n/backend/active_record.rb @@ -64,7 +64,7 @@ def initialized? end def init_translations - @translations = Translation.to_hash + @translations = Translation.to_h end def translations(do_init: false) diff --git a/lib/i18n/backend/active_record/translation.rb b/lib/i18n/backend/active_record/translation.rb index f516f86..ee03a64 100644 --- a/lib/i18n/backend/active_record/translation.rb +++ b/lib/i18n/backend/active_record/translation.rb @@ -79,7 +79,7 @@ def available_locales Translation.select('DISTINCT locale').to_a.map { |t| t.locale.to_sym } end - def to_hash + def to_h Translation.all.each.with_object({}) do |t, memo| locale_hash = (memo[t.locale.to_sym] ||= {}) keys = t.key.split('.')