Method not available on this version
This method is only available on newer versions.
The first available version (v8.0.0) is shown here.
validate_has_one_association(reflection)
private
Validate the association if :validate or :autosave is
turned on for the has_one association.
# File activerecord/lib/active_record/autosave_association.rb, line 329
def validate_has_one_association(reflection)
association = association_instance_get(reflection.name)
record = association && association.reader
return unless record && (record.changed_for_autosave? || custom_validation_context?)
inverse_association = reflection.inverse_of && record.association(reflection.inverse_of.name)
return if inverse_association && (record.validating_belongs_to_for?(inverse_association) ||
record.autosaving_belongs_to_for?(inverse_association))
association_valid?(association, record)
end