2021-12-16 09:49:49 +01:00
|
|
|
namespace :zones do
|
|
|
|
task populate_zones: :environment do
|
|
|
|
puts "Running deploy task 'populate_zones'"
|
2021-12-14 14:33:19 +01:00
|
|
|
|
2021-12-16 09:49:49 +01:00
|
|
|
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
|
2021-12-14 14:33:19 +01:00
|
|
|
end
|
|
|
|
end
|