How to reset a single table in rails?

A lot of people (like me) come here to find how to delete all the data in the table. Here you go:

$ rails console

> ModelName.delete_all

or

> ModelName.destroy_all

destroy_all checks dependencies and callbacks, and takes a little longer.
delete_all is a straight SQL query.

More info here: http://apidock.com/rails/ActiveRecord/Base/delete_all/class

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)