aboutsummaryrefslogtreecommitdiffstats
path: root/config/initializers/stif.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers/stif.rb')
-rw-r--r--config/initializers/stif.rb31
1 files changed, 17 insertions, 14 deletions
diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb
index 2ddadbc7e..be25a329f 100644
--- a/config/initializers/stif.rb
+++ b/config/initializers/stif.rb
@@ -1,24 +1,27 @@
# coding: utf-8
+
Rails.application.config.to_prepare do
Organisation.after_create do |organisation|
- line_referential = LineReferential.find_by(name: "CodifLigne")
- stop_area_referential = StopAreaReferential.find_by(name: "Reflex")
+ unless organisation.code == "STIF" # seed is in action
+ line_referential = LineReferential.find_by(name: "CodifLigne")
+ stop_area_referential = StopAreaReferential.find_by(name: "Reflex")
- line_referential.organisations << organisation
- stop_area_referential.organisations << organisation
+ line_referential.organisations << organisation
+ stop_area_referential.organisations << organisation
- workgroup = Workgroup.find_or_create_by(name: "Gestion de l'offre théorique IDFm") do |w|
- w.line_referential = line_referential
- w.stop_area_referential = stop_area_referential
- end
+ workgroup = Workgroup.find_or_create_by(name: "Gestion de l'offre théorique IDFm") do |w|
+ w.line_referential = line_referential
+ w.stop_area_referential = stop_area_referential
+ end
- workbench = 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
- w.workgroup = workgroup
+ 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
+ w.workgroup = workgroup
- Rails.logger.debug "Create Workbench for #{organisation.name}"
+ Rails.logger.debug "Create Workbench for #{organisation.name}"
+ end
end
end
end unless Rails.env.test?