Created
September 12, 2015 11:18
-
-
Save ParthivPatel-BTC/dc928111bb662fe6287d to your computer and use it in GitHub Desktop.
Delete all database records
This file contains hidden or 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
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