.delete all

suggest change

delete_all removes many rows in one SQL DELETE. Call it on a model or on a relation. It does not instantiate records, so before_destroy and after_destroy do not run, and dependent associations are not destroyed.

User.delete_all
# => 39  # number of rows deleted

User.where(name: "John").delete_all

User.delete_all with no condition deletes every row in users. Prefer a where unless that is what you want.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents