Giter Site home page Giter Site logo

Comments (5)

djezzzl avatar djezzzl commented on June 12, 2024 2

Hi there ๐Ÿ‘‹

First, thank you both for using the gem and reporting the issue!

The idea that @chaadow has suggested seems reasonable here. Even though it may bring false positives (in cases with custom if: :something), at least we will have less noise now. Also, it's worth adding that covering this case is "nice to have" rather than a critical issue (like missing unique indexes).

There is also a way to patch ActiveRecord to "mark" those presence validators with this optimized "if" condition. As the database_consistency runner is expected to run as a separate process on demand, we can do that without affecting other environments (development/production/test, etc). However, maintaining it could be slightly more complicated and unwelcome.

With that said, I would go with this proposal by chaadow.

Would you mind creating a PR? I would be happy to merge it and release it ASAP.

P.S. It would be good to add one more check to your condition that the ActiveRecord's version is 7.1+

P.P.S. And again, thank you, @chaadow and @agrobbin! Sorry for being late.

from database_consistency.

djezzzl avatar djezzzl commented on June 12, 2024 2

Released in 1.7.21!

Thank you again! Have a great week!

from database_consistency.

chaadow avatar chaadow commented on June 12, 2024 1

@djezzzl @agrobbin I made this little "quick fix" which made all my belongs_to pass with rails 7.1 defaults
chaadow@2270738

haven't tested backward compatibility. but if you can take a look maybe I can create a PR with this change

from database_consistency.

chaadow avatar chaadow commented on June 12, 2024

HI @djezzzl Unfortunately this checker fails in rails 7.1 ( which was released about a week ago )

from database_consistency.

agrobbin avatar agrobbin commented on June 12, 2024

At first glance it seems like a reasonable guess, but I'll defer to @djezzzl here, as I'm not sure if that's "safe enough".

from database_consistency.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.