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

Add support for rails 7.1 #216

Merged
merged 2 commits into from
Oct 15, 2023
Merged

Add support for rails 7.1 #216

merged 2 commits into from
Oct 15, 2023

Conversation

chaadow
Copy link
Contributor

@chaadow chaadow commented Oct 15, 2023

fixes #215

rails 7.1 recently added this new default configuration option

When set to false ( default in rails 7.1 ) an if option is added to the belongs_to option. which makes it not compatible with the current WEAK_OPTIONS array.

To cover this new case, and as a pre-check, we make sure that we're on rails 7.1.0 minimum as well as the ActiveRecord option ( ActiveRecord.belongs_to_required_validates_foreign_key ) is set to false to mitigate issues with real if conditions. We also check that the if condition is coupled with a message option set to required

This commit also adds rails 7.1 to the CI matrix.

cc @djezzzl @agrobbin

@chaadow
Copy link
Contributor Author

chaadow commented Oct 15, 2023

@djezzzl btw I'm going to go ahead and try to add rails 7.1 to the github CI matrix. as well as add a unit test to the presence checker 👍🏼

Fixes djezzzl#215.

rails 7.1 recently added  this new default [configuration option](https://guides.rubyonrails.org/configuring.html#config-active-record-belongs-to-required-validates-foreign-key )

When set to false ( default in rails 7.1 ) an `if` option is added to the belongs_to option. which makes it not compatible with the current `WEAK_OPTIONS` array.

To cover this new case, and as a pre-check, we make sure that we're on rails 7.1.0 minimum as well as the ActiveRecord option ( `ActiveRecord.belongs_to_required_validates_foreign_key` ) is set to false to mitigate issues with real `if` conditions. We also check that the if condition is coupled with a `message` option set to `required`

This commit also adds rails 7.1 to the CI matrix.
@chaadow
Copy link
Contributor Author

chaadow commented Oct 15, 2023

rebased and squashed

@djezzzl djezzzl merged commit 81a10b5 into djezzzl:master Oct 15, 2023
8 checks passed
@djezzzl
Copy link
Owner

djezzzl commented Oct 15, 2023

Thank you very much for your contribution!

I'll update a changelog and release it today! Please let me know if you have any more ideas to make this gem more helpful.

Have a great day and the upcoming week!

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.

ColumnPresenceChecker is incompatible with Rails' new default belongs_to validation behavior
2 participants