Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MissingNonNullConstraint to work with ActiveRecord.belongs_to_required_validates_foreign_key #151

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fatkodima
Copy link
Contributor

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 rails/rails#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 and ActiveRecord.belongs_to_required_validates_foreign_key == false, then this condition was set with the rails itself (not a conditional set by the user).

gregnavis and others added 2 commits October 16, 2023 20:03
This commit adds a new option for ignoring entire databases and models
backed by them. incorrect_boolean_presence_validation is the first
detector that gained that new option.
@gregnavis gregnavis force-pushed the master branch 2 times, most recently from 168d951 to d322a6e Compare October 20, 2023 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants