-
-
Save lmiller1990/6785c2ebe503c113f28f78a086e9ad59 to your computer and use it in GitHub Desktop.
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
module Test | |
class DatabasesController < ApplicationController | |
skip_before_action :verify_authenticity_token | |
def clean_database | |
tables = ActiveRecord::Base.connection.tables | |
tables.delete 'schema.migrations' | |
tables.each { |t| ActiveRecord::Base.connection.execute("TRUNCATE #{t} CASCADE") } | |
Rails.application.load_seed unless ['false', false].include?(params['database']['should_seed']) | |
render plain: 'Truncated and seeded database' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment