diff --git a/activemodel/lib/active_model/attribute_registration.rb b/activemodel/lib/active_model/attribute_registration.rb index 6574c01c9beaa..3159b021493b5 100644 --- a/activemodel/lib/active_model/attribute_registration.rb +++ b/activemodel/lib/active_model/attribute_registration.rb @@ -40,11 +40,6 @@ def attribute_types # :nodoc: end end - # Returns the type of the specified attribute after applying any - # modifiers. This method is the only valid source of information for - # anything related to the types of a model's attributes. The return value - # of this method will implement the interface described by - # ActiveModel::Type::Value (though the object itself may not subclass it). def type_for_attribute(attribute_name, &block) attribute_name = resolve_attribute_name(attribute_name) diff --git a/activemodel/lib/active_model/attributes.rb b/activemodel/lib/active_model/attributes.rb index 0c21b57201d03..0e3aee5a2fb75 100644 --- a/activemodel/lib/active_model/attributes.rb +++ b/activemodel/lib/active_model/attributes.rb @@ -75,6 +75,19 @@ def attribute_names attribute_types.keys end + ## + # :method: type_for_attribute + # :call-seq: type_for_attribute(attribute_name, &block) + # + # Returns the type of the specified attribute after applying any + # modifiers. This method is the only valid source of information for + # anything related to the types of a model's attributes. The return value + # of this method will implement the interface described by + # ActiveModel::Type::Value (though the object itself may not subclass it). + #-- + # Implemented by ActiveModel::AttributeRegistration::ClassMethods#type_for_attribute. + + ## private def define_method_attribute=(name, owner:) ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method( diff --git a/activerecord/lib/active_record/attributes.rb b/activerecord/lib/active_record/attributes.rb index c168de76a9d0d..87e34dee88ad8 100644 --- a/activerecord/lib/active_record/attributes.rb +++ b/activerecord/lib/active_record/attributes.rb @@ -253,11 +253,14 @@ def _default_attributes # :nodoc: # :method: type_for_attribute # :call-seq: type_for_attribute(attribute_name, &block) # - # See ActiveModel::AttributeRegistration::ClassMethods#type_for_attribute. + # See ActiveModel::Attributes::ClassMethods#type_for_attribute. # # This method will access the database and load the model's schema if # necessary. + #-- + # Implemented by ActiveModel::AttributeRegistration::ClassMethods#type_for_attribute. + ## protected def reload_schema_from_cache(*) reset_default_attributes!