Rails 7.1 introduced an optimization to required belongs_to association to not check for presence when foreign key's value hasn't changed (see https://github.com/rails/rails/pull/46522 for details).
In this PR I made active_record_doctor be aware of this configuration. We can assume, that if a validator has an :if condition and validation's message is :requiredandActiveRecord.belongs_to_required_validates_foreign_key == false, then this condition was set with the rails itself (not a conditional set by the user).
Rails 7.1 introduced an optimization to required
belongs_to
association to not check for presence when foreign key's value hasn't changed (see https://github.com/rails/rails/pull/46522 for details).In this PR I made
active_record_doctor
be aware of this configuration. We can assume, that if a validator has an:if
condition and validation's message is:required
andActiveRecord.belongs_to_required_validates_foreign_key == false
, then this condition was set with the rails itself (not a conditional set by the user).