diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-09-09 09:44:48 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-09-09 10:00:30 +0200 |
commit | d5580b91b64daeb114875f24f6d54bbf88428018 (patch) | |
tree | 0f0774a4cd5b70fa2adc2fbde98737451eab3f0b /activerecord/lib/active_record | |
parent | c563656a48b81bbbf13b2c6e336af71f38434c77 (diff) | |
download | rails-d5580b91b64daeb114875f24f6d54bbf88428018.tar.gz rails-d5580b91b64daeb114875f24f6d54bbf88428018.tar.bz2 rails-d5580b91b64daeb114875f24f6d54bbf88428018.zip |
Allow included modules to override association methods.
Closes #16684.
This is achieved by always generating `GeneratedAssociationMethods` when
`ActiveRecord::Base` is subclassed. When some of the included modules
of `ActiveRecord::Base` were reordered this behavior was broken as
`Core#initialize_generated_modules` was no longer called. Meaning that
the module was generated on first access.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/core.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index 43a3993898..36d0d63c71 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -69,6 +69,8 @@ module ActiveRecord @generated_attribute_methods = GeneratedAttributeMethods.new { extend Mutex_m } @attribute_methods_generated = false include @generated_attribute_methods + + super end # Generates all the attribute related methods for columns in the database diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 2e9c9e3197..83859e474a 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -183,8 +183,6 @@ module ActiveRecord end def initialize_generated_modules - super - generated_association_methods end |