djezzzl / database_consistency

The tool to avoid various issues due to inconsistencies and inefficiencies between a database schema and application models.
MIT License
1.02k stars 43 forks source link

Add support for rails 7.1 #216

Closed chaadow closed 9 months ago

chaadow commented 9 months ago

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 commented 9 months ago

@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 👍🏼

chaadow commented 9 months ago

rebased and squashed

djezzzl commented 9 months ago

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!