Giter Site home page Giter Site logo

Comments (4)

shanecav84 avatar shanecav84 commented on May 18, 2024 1

That's new to me. Rails always has something up its sleeve.

A configurable boolean attribute StrictValidations that would ignore non-bang persistence methods could be useful.

from rubocop-rails.

ibrahima avatar ibrahima commented on May 18, 2024 1

Hmm, is there any opposition to adding such a cop for those who are not using strict validations? While that seems like a nice option, it would require more code changes, and in the meantime this cop would probably help a lot of people if it was available.

With strict validations a simple version of this cop would have false positives, but someone using strict validations could just disable it? Not sure what level of static analysis could be done to figure out whether the class in question is using strict validations or not.

from rubocop-rails.

andyw8 avatar andyw8 commented on May 18, 2024

If a model was using strict validations, save can raise ActiveModel::StrictValidationFailed which would trigger a rollback.

https://guides.rubyonrails.org/active_record_validations.html#strict-validations

from rubocop-rails.

tejasbubane avatar tejasbubane commented on May 18, 2024

Sorry for digging up on this old issue. But I think it still makes sense to have such a cop. I may not want to make all my validations strict, just the ones in an explicit transaction.

from rubocop-rails.

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.