Skip to content

Instantly share code, notes, and snippets.

@mindaslab
Created April 26, 2016 03:04
Show Gist options
  • Save mindaslab/9d09e06bcb67dc5f795bb272bd0f431d to your computer and use it in GitHub Desktop.
Save mindaslab/9d09e06bcb67dc5f795bb272bd0f431d to your computer and use it in GitHub Desktop.
# 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