diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-07-02 17:03:32 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-07-02 17:03:32 -0700 |
commit | 9f76531c3a7a6ff32515d2238cf26dbd772467d7 (patch) | |
tree | f6b6d63f382e6f87acee5938f512b97e2c46d505 | |
parent | 79b88e875b407f8418932fb757999909c2083b89 (diff) | |
download | rails-9f76531c3a7a6ff32515d2238cf26dbd772467d7.tar.gz rails-9f76531c3a7a6ff32515d2238cf26dbd772467d7.tar.bz2 rails-9f76531c3a7a6ff32515d2238cf26dbd772467d7.zip |
push attribute constant cache in to the attribute methods module
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 10 | ||||
-rw-r--r-- | activerecord/lib/active_record/core.rb | 6 |
2 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 5e990955ab..abaa820ac5 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -26,7 +26,15 @@ module ActiveRecord end def initialize_generated_modules # :nodoc: - @generated_attribute_methods = Module.new { extend Mutex_m } + @generated_attribute_methods = Module.new { + extend Mutex_m + + const_set :AttrNames, Module.new { + def self.const_missing(name) + const_set(name, [name.to_s.sub(/ATTR_/, '')].pack('h*').freeze) + end + } + } @attribute_methods_generated = false include @generated_attribute_methods end diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 7da70cea18..c6b7da2e3c 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -90,12 +90,6 @@ module ActiveRecord module ClassMethods def initialize_generated_modules super - # force attribute methods to be higher in inheritance hierarchy than other generated methods - generated_attribute_methods.const_set(:AttrNames, Module.new { - def self.const_missing(name) - const_set(name, [name.to_s.sub(/ATTR_/, '')].pack('h*').freeze) - end - }) generated_feature_methods end |