Skip to content
Browse files

Add a deprecation for nested i18n namespace lookup.

  • Loading branch information...
1 parent 83efad0 commit c19bd4f88ea5cf56b2bc8ac0b97f59c5c89dbff7 @josevalim josevalim committed Jun 11, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 activerecord/lib/active_record/railtie.rb
View
16 activerecord/lib/active_record/railtie.rb
@@ -96,5 +96,21 @@ class Railtie < Rails::Railtie
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

0 comments on commit c19bd4f

Please sign in to comment.
Something went wrong with that request. Please try again.