aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/referential.rb
diff options
context:
space:
mode:
authorTeddy Wing2017-12-05 18:26:57 +0100
committerTeddy Wing2017-12-05 18:26:57 +0100
commit47181fd81105396b2db394958c39a6e40bc6f0f0 (patch)
treee95e67d8479f348453e3e494b5991053b15ba3de /app/models/referential.rb
parent1098e24f15b235dce127f0398adac4bbf7cfe463 (diff)
parent9f1aa4d40d7d968963dae5799e15ad5da4cbcbc5 (diff)
downloadchouette-core-47181fd81105396b2db394958c39a6e40bc6f0f0.tar.bz2
Merge remote-tracking branch 'origin/master' into 5024-prevent-duplicate-referentials-from-being-created-during-parallel-db-transactions--rb201711271659
Conflicts: app/models/referential.rb A whitespace conflict in a place I don't even remember editing? Okaay.
Diffstat (limited to 'app/models/referential.rb')
-rw-r--r--app/models/referential.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb
index c91007172..f89eafee8 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -127,10 +127,11 @@ class Referential < ActiveRecord::Base
Chouette::RoutingConstraintZone.all
end
- after_initialize :define_default_attributes
+ before_validation :define_default_attributes
def define_default_attributes
self.time_zone ||= Time.zone.name
+ self.objectid_format ||= workbench.objectid_format if workbench
end
def switch
@@ -149,6 +150,7 @@ class Referential < ActiveRecord::Base
line_referential: from.line_referential,
stop_area_referential: from.stop_area_referential,
created_from: from,
+ objectid_format: from.objectid_format,
metadatas: from.metadatas.map { |m| ReferentialMetadata.new_from(m, functional_scope) }
)
end