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
Is your feature request related to a problem? Please describe.
We were recently burned by a scenario where we were calling delete on some models and/or delete_all on some associations and bypassing various callbacks before_destroys etc.
I could see a distinct rule of preferring destroy and destroy_all over delete/delete_all being a preferred alternative since really it's about before_destroy callbacks (and/or setting updated_at if you use something like acts_as_paranoid) vs hitting the actual model validations
Additional context
Sorry if this is a little thin. Given a bit more time (and assuming it's wanted) I'll take a swing at the alternative option and submit it as a PR.
The text was updated successfully, but these errors were encountered:
Once added to that, it could then be added to the Style Guide. Eventually it will be reflected in the style guide implementation Rails/SkipsModelValidations.
koic
transferred this issue from rubocop/rubocop-rails
Mar 29, 2023
Is your feature request related to a problem? Please describe.
We were recently burned by a scenario where we were calling delete on some models and/or delete_all on some associations and bypassing various callbacks before_destroys etc.
Describe the solution you'd like
I'm thinking it'd be nice to have delete, and delete_all added to the list for https://rails.rubystyle.guide/#beware-skip-model-validations
Describe alternatives you've considered
I could see a distinct rule of preferring destroy and destroy_all over delete/delete_all being a preferred alternative since really it's about before_destroy callbacks (and/or setting updated_at if you use something like acts_as_paranoid) vs hitting the actual model validations
Additional context
Sorry if this is a little thin. Given a bit more time (and assuming it's wanted) I'll take a swing at the alternative option and submit it as a PR.
The text was updated successfully, but these errors were encountered: