Skip to content

Instantly share code, notes, and snippets.

@ParthivPatel-BTC
Created September 12, 2015 11:18
Show Gist options
  • Save ParthivPatel-BTC/dc928111bb662fe6287d to your computer and use it in GitHub Desktop.
Save ParthivPatel-BTC/dc928111bb662fe6287d to your computer and use it in GitHub Desktop.
Delete all database records
ActiveRecord::Base.connection.tables.map do |model|
unless ['schema_migrations', 'cic_user_profiles'].include?(model)
klass = model.capitalize.singularize.camelize.constantize
puts "Deleting #{klass}"
klass.delete_all
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment