Skip to content

Commit 2c2ccec

Browse files
Fix method visibility in ActiveRecord::Attributes
Follow-up to rails#44666. `ActiveRecord::ModelSchema#reload_schema_from_cache` is protected and `ActiveModel::AttributeRegistration#reset_default_attributes` is private, so their overrides in `ActiveRecord::Attributes` should match those visibilities.
1 parent 296664d commit 2c2ccec

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

activerecord/lib/active_record/attributes.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,11 @@ def _default_attributes # :nodoc:
249249
end
250250
end
251251

252-
def reload_schema_from_cache(*)
253-
reset_default_attributes!
254-
super
255-
end
256-
257-
alias :reset_default_attributes :reload_schema_from_cache
252+
protected
253+
def reload_schema_from_cache(*)
254+
reset_default_attributes!
255+
super
256+
end
258257

259258
private
260259
NO_DEFAULT_PROVIDED = Object.new # :nodoc:
@@ -276,6 +275,10 @@ def define_default_attribute(name, value, type, from_user:)
276275
_default_attributes[name] = default_attribute
277276
end
278277

278+
def reset_default_attributes
279+
reload_schema_from_cache
280+
end
281+
279282
def resolve_type_name(name, **options)
280283
Type.lookup(name, **options, adapter: Type.adapter_name_from(self))
281284
end

0 commit comments

Comments
 (0)