Created
June 3, 2015 13:44
-
-
Save emad-elsaid/a00c0eed2de964a95653 to your computer and use it in GitHub Desktop.
A Collection of rails Rake Tasks
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
namespace :db do | |
desc "Erase all tables" | |
task :clear => :environment do | |
conn = ActiveRecord::Base.connection | |
tables = conn.tables | |
tables.each do |table| | |
puts "Deleting #{table}" | |
conn.drop_table(table) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment