foodsoft/lib/tasks/seeds.rake
FGU 38c27a23f5
Some checks failed
continuous-integration/drone/push Build is failing
make rails 7 and ruby 2.7 run in Docker (and on mac)
2022-12-12 14:21:25 +01:00

16 lines
563 B
Ruby

# Allow loading multiple seeds
# Tried using seedbank, but that supposes all seeds are loaded, while
# we want to have different options to choose from (and they can't
# be loaded at the same time).
require 'pathname'
namespace :db do
namespace :seed do
Dir.glob(Rails.root.join('db/seeds/*.seeds.rb')).sort.each do |seedfile|
desc "Load the seed data from #{Pathname.new(seedfile).relative_path_from(Rails.root)}"
task File.basename(seedfile, '.seeds.rb') => :environment do
require_relative seedfile
end
end
end
end