Skip to content

Instantly share code, notes, and snippets.

@sandinist
Created May 30, 2012 09:44
Show Gist options
  • Save sandinist/2835165 to your computer and use it in GitHub Desktop.
Save sandinist/2835165 to your computer and use it in GitHub Desktop.
truncate tables
tables = (ActiveRecord::Base.connection.tables - %w{schema_migrations})
tables.each {|table|
ActiveRecord::Base.connection.execute("TRUNCATE TABLE #{table};")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment