Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Forked from ParthivPatel-BTC/test.rb
Created September 30, 2015 12:39
Show Gist options
  • Save amitpatelx/bad1c5af91deaf01002f to your computer and use it in GitHub Desktop.
Save amitpatelx/bad1c5af91deaf01002f 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