Created
March 1, 2011 23:13
-
-
Save joshsusser/850100 to your computer and use it in GitHub Desktop.
reset all db tables before re-seeding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# reset tables | |
tables = ActiveRecord::Base.connection.tables | |
tables.delete("schema_migrations") | |
tables.each do |table| | |
ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table}") | |
ActiveRecord::Base.connection.reset_pk_sequence!(table) | |
end | |
# seed data | |
# | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment