Created
July 30, 2020 17:53
-
-
Save kermit-klein/a8e0cd73333955f937eca5efe3736b9d to your computer and use it in GitHub Desktop.
cypress_controller
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
class Test::DatabasesController < ApplicationController | |
def reset_database | |
tables = ActiveRecord::Base.connection.tables | |
tables.delete 'schema.migrations' | |
tables.each do |table| | |
ActiveRecord::Base.connection.execute("DELETE FROM #{table}") | |
ActiveRecord::Base.connection.execute("DELETE FROM sqlite_sequence where name='#{table}'") | |
end | |
Rails.application.load_seed if params['seed'] == true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment