• C
    Give GeneratedAttributeMethods module a name · 8ca3c286
    Chris Salzberg 提交于
    Currently GeneratedAttributeMethods is a module builder class, an
    instance of which is included in every AR class. OTOH,
    GeneratedAssociatedMethods is assigned to a constant under the model
    namespace. This is inconsistent and looks strange in the list of
    ancestors.
    
    There is no particular reason *not* to assign a constant for this (very
    important) module under the model namespace, so that's what this commit
    does.
    
    Previous to this change, ancestors for an AR class looked like this:
    
    ```
    => [User (call 'User.connection' to establish a connection),
     User::GeneratedAssociationMethods,
     #<ActiveRecord::AttributeMethods::GeneratedAttributeMethods:0x000055ace0f05b08>,
     ApplicationRecord(abstract),
     ApplicationRecord::GeneratedAssociationMethods,
     #<ActiveRecord::AttributeMethods::GeneratedAttributeMethods:0x000055ace093c460>,
     ActiveRecord::Base,
     ...
    ```
    
    With this change, they look like this:
    
    ```
    => [User (call 'User.connection' to establish a connection),
     User::GeneratedAssociationMethods,
     User::GeneratedAttributeMethods,
     ApplicationRecord(abstract),
     ApplicationRecord::GeneratedAssociationMethods,
     ApplicationRecord::GeneratedAttributeMethods,
     ActiveRecord::Base,
     ...
    ```
    
    The previously named `GeneratedAttributeMethods` module builder class is
    renamed `GeneratedAttributeMethodsBuilder` to emphasize that this is not
    a module but a class.
    8ca3c286
attribute_methods.rb 16.6 KB