diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2019-03-19 21:17:02 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-19 21:17:02 -0400 |
commit | 3dee96e92b08edafa2a7be6964b0596bb738f709 (patch) | |
tree | 3466be4920bc55d770514c7d4996e032a110095b /activerecord/lib | |
parent | b504a5d96e0ec30856a3fc54305550f3586002aa (diff) | |
parent | 8ca3c286a768038f6b391fd3bfbdfcc299876a1f (diff) | |
download | rails-3dee96e92b08edafa2a7be6964b0596bb738f709.tar.gz rails-3dee96e92b08edafa2a7be6964b0596bb738f709.tar.bz2 rails-3dee96e92b08edafa2a7be6964b0596bb738f709.zip |
Merge pull request #35595 from shioyama/generated_attribute_methods_namespaced_constant
Give GeneratedAttributeMethods module a name
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb index fd8c1da842..af7e46e649 100644 --- a/activerecord/lib/active_record/attribute_methods.rb +++ b/activerecord/lib/active_record/attribute_methods.rb @@ -24,7 +24,7 @@ module ActiveRecord RESTRICTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass) - class GeneratedAttributeMethods < Module #:nodoc: + class GeneratedAttributeMethodsBuilder < Module #:nodoc: include Mutex_m end @@ -35,7 +35,8 @@ module ActiveRecord end def initialize_generated_modules # :nodoc: - @generated_attribute_methods = GeneratedAttributeMethods.new + @generated_attribute_methods = const_set(:GeneratedAttributeMethods, GeneratedAttributeMethodsBuilder.new) + private_constant :GeneratedAttributeMethods @attribute_methods_generated = false include @generated_attribute_methods @@ -88,7 +89,7 @@ module ActiveRecord # If ThisClass < ... < SomeSuperClass < ... < Base and SomeSuperClass # defines its own attribute method, then we don't want to overwrite that. defined = method_defined_within?(method_name, superclass, Base) && - ! superclass.instance_method(method_name).owner.is_a?(GeneratedAttributeMethods) + ! superclass.instance_method(method_name).owner.is_a?(GeneratedAttributeMethodsBuilder) defined || super end end |