Skip to content

Add delete_all to the list of methods that skip model validations #332

@etherbob

Description

@etherbob

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions