Last Updated: February 25, 2016
·
1.661K
· freiden

Rails - Clear table and reset auto_increment

A little memo to remember how to do this found on stackoverflow (cf. http://stackoverflow.com/a/13173994 ):

Model.destroy_all
ActiveRecord::Base.connection.execute("TRUNCATE table_name")