You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The update_attribute method skips validations and will save the object to database regardless of its validity. These methods should be used with caution.
Not just update_attribute, I think we should we warn against all of those methods which skip validations. Even save(validate: false).
I agree that we should warn against all of the methods that skip validations. I don't think that we should warn against save(validate: false) because someone has to explicitly say that they do not want validations. The other ActiveRecord methods are most likely used by mistake.
The update_attribute method skips validations and will save the object to database regardless of its validity.
These methods should be used with caution.
Prefer this:
over:
Bugs resulting from this can be hard to identify, and I cannot see a valid use-case for updating a model attribute without validation.
Is this a reasonable candidate for inclusion as a Rails-specific cop in RuboCop?
The text was updated successfully, but these errors were encountered: