From c19bd4f88ea5cf56b2bc8ac0b97f59c5c89dbff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 11 Jun 2011 17:56:30 +0200 Subject: [PATCH] Add a deprecation for nested i18n namespace lookup. --- activerecord/lib/active_record/railtie.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index 47133e77e8..5502e3fc14 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -96,5 +96,21 @@ module ActiveRecord end end end + + config.after_initialize do + container = :"activerecord.attributes" + I18n.t(container, :default => {}).each do |key, value| + if value.is_a?(Hash) && value.any? { |k,v| v.is_a?(Hash) } + $stderr.puts "[DEPRECATION WARNING] Nested I18n namespace lookup under \"#{container}.#{key}\" is no longer supported" + end + end + + container = :"activerecord.models" + I18n.t(container, :default => {}).each do |key, value| + if value.is_a?(Hash) + $stderr.puts "[DEPRECATION WARNING] Nested I18n namespace lookup under \"#{container}.#{key}\" is no longer supported" + end + end + end end end