-
-
Save EdwardDiehl/beca2cabc398355b80e8c57846046164 to your computer and use it in GitHub Desktop.
Rake task to reset and seed Rails database
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
# Originally written by Justin French (2008): | |
# http://justinfrench.com/notebook/a-custom-rake-task-to-reset-and-seed-your-database | |
# | |
# Modified to work with Rails 4. | |
desc 'Raise an error unless development environment' | |
task :safety_check do | |
raise "You can only use this in dev!" unless Rails.env.development? | |
end | |
namespace :db do | |
desc 'Drop, create, migrate then seed the development database' | |
task reseed: [ | |
'environment', | |
'safety_check', | |
'db:reset', | |
'db:seed' | |
] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment