demarches-normaliennes/lib/tasks/populate_zones.rake
2021-12-16 17:20:06 +01:00

12 lines
431 B
Ruby

namespace :zones do
task populate_zones: :environment do
puts "Running deploy task 'populate_zones'"
Zone.create!(acronym: 'COLLECTIVITE', label: 'Collectivité territoriale')
config = Psych.safe_load(File.read(Rails.root.join("config", "zones.yml")))
config["ministeres"].each do |ministere|
acronym = ministere.keys.first
Zone.create!(acronym: acronym, label: ministere["label"])
end
end
end