Created
April 28, 2017 15:15
-
-
Save c80609a/ce9058d176c793877562411439b27a17 to your computer and use it in GitHub Desktop.
custom_seed.rake
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
# lib/tasks/custom_seed.rake | |
namespace :db do | |
namespace :seed do | |
Dir[File.join(Rails.root, 'db', 'seeds', '*.rb')].each do |filename| | |
task_name = File.basename(filename, '.rb').intern | |
task task_name => :environment do | |
load(filename) if File.exist?(filename) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment