diff options
| author | Alban Peignier | 2018-05-10 21:51:48 +0200 | 
|---|---|---|
| committer | Alban Peignier | 2018-05-10 22:46:46 +0200 | 
| commit | f39d3c0d75e7ef8476412dc4fa5d19701967c20c (patch) | |
| tree | a64af990998f47fb54803b19e2ce11c2db0665fa | |
| parent | 54014f06e0c076404081e66b741f08c151d7ba4b (diff) | |
| download | chouette-core-f39d3c0d75e7ef8476412dc4fa5d19701967c20c.tar.bz2 | |
Define Workgroup owner and ignore STIF organisation in initializer callback. Refs #6960
| -rw-r--r-- | config/initializers/stif.rb | 8 | ||||
| -rw-r--r-- | db/seeds/stif.seeds.rb | 7 | 
2 files changed, 10 insertions, 5 deletions
| diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb index ab2410b33..7a61e7044 100644 --- a/config/initializers/stif.rb +++ b/config/initializers/stif.rb @@ -1,8 +1,8 @@  # coding: utf-8 -unless ENV.fetch("SEED", false) || Rails.env.test? -  Rails.application.config.to_prepare do -    Organisation.after_create do |organisation| +Rails.application.config.to_prepare do +  Organisation.after_create do |organisation| +    unless organisation.code == "STIF" # seed is in action        line_referential      = LineReferential.find_by(name: "CodifLigne")        stop_area_referential = StopAreaReferential.find_by(name: "Reflex") @@ -14,7 +14,7 @@ unless ENV.fetch("SEED", false) || Rails.env.test?          w.stop_area_referential = stop_area_referential        end -      workbench = organisation.workbenches.find_or_create_by(name: "Gestion de l'offre") do |w| +      organisation.workbenches.find_or_create_by(name: "Gestion de l'offre") do |w|          w.line_referential      = line_referential          w.stop_area_referential = stop_area_referential          w.objectid_format       = Workbench.objectid_format.stif_netex diff --git a/db/seeds/stif.seeds.rb b/db/seeds/stif.seeds.rb index e2c5542f5..ec43db6bb 100644 --- a/db/seeds/stif.seeds.rb +++ b/db/seeds/stif.seeds.rb @@ -23,4 +23,9 @@ workgroup = Workgroup.seed_by(name: "Gestion de l'offre théorique IDFm") do |w|    w.owner                 = stif  end -Workbench.update_all workgroup_id: workgroup +stif.workbenches.seed_by(name: "Gestion de l'offre") do |w| +  w.line_referential      = line_referential +  w.stop_area_referential = stop_area_referential +  w.objectid_format       = Workbench.objectid_format.stif_netex +  w.workgroup             = workgroup +end | 
