.delete all
suggest changedelete_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.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents