Skip to content

Commit 2945608

Browse files
Ensure type_for_attribute method docs are visible [ci-skip]
`ActiveModel::AttributeRegistration` is marked `:nodoc:`, so `type_for_attribute` must be documented under `ActiveModel::Attributes`, which includes `ActiveModel::AttributeRegistration`. Also, RDoc does not correctly interpret `:method:` docs when they are immediately followed by a visibility keyword. Therefore, this commit adds delimiter comments before the keywords, similar to 4726b1a.
1 parent b294a25 commit 2945608

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

activemodel/lib/active_model/attribute_registration.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ def attribute_types # :nodoc:
4040
end
4141
end
4242

43-
# Returns the type of the specified attribute after applying any
44-
# modifiers. This method is the only valid source of information for
45-
# anything related to the types of a model's attributes. The return value
46-
# of this method will implement the interface described by
47-
# ActiveModel::Type::Value (though the object itself may not subclass it).
4843
def type_for_attribute(attribute_name, &block)
4944
attribute_name = resolve_attribute_name(attribute_name)
5045

activemodel/lib/active_model/attributes.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@ def attribute_names
7575
attribute_types.keys
7676
end
7777

78+
##
79+
# :method: type_for_attribute
80+
# :call-seq: type_for_attribute(attribute_name, &block)
81+
#
82+
# Returns the type of the specified attribute after applying any
83+
# modifiers. This method is the only valid source of information for
84+
# anything related to the types of a model's attributes. The return value
85+
# of this method will implement the interface described by
86+
# ActiveModel::Type::Value (though the object itself may not subclass it).
87+
#--
88+
# Implemented by ActiveModel::AttributeRegistration::ClassMethods#type_for_attribute.
89+
90+
##
7891
private
7992
def define_method_attribute=(name, owner:)
8093
ActiveModel::AttributeMethods::AttrNames.define_attribute_accessor_method(

activerecord/lib/active_record/attributes.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,14 @@ def _default_attributes # :nodoc:
253253
# :method: type_for_attribute
254254
# :call-seq: type_for_attribute(attribute_name, &block)
255255
#
256-
# See ActiveModel::AttributeRegistration::ClassMethods#type_for_attribute.
256+
# See ActiveModel::Attributes::ClassMethods#type_for_attribute.
257257
#
258258
# This method will access the database and load the model's schema if
259259
# necessary.
260+
#--
261+
# Implemented by ActiveModel::AttributeRegistration::ClassMethods#type_for_attribute.
260262

263+
##
261264
protected
262265
def reload_schema_from_cache(*)
263266
reset_default_attributes!

0 commit comments

Comments
 (0)