aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/chouette/journey_pattern.rb4
-rw-r--r--app/models/chouette/route.rb4
-rw-r--r--app/models/chouette/routing_constraint_zone.rb4
-rw-r--r--app/models/chouette/time_table.rb4
-rw-r--r--app/models/chouette/vehicle_journey.rb4
5 files changed, 18 insertions, 2 deletions
diff --git a/app/models/chouette/journey_pattern.rb b/app/models/chouette/journey_pattern.rb
index 868d8121e..b28c77c9a 100644
--- a/app/models/chouette/journey_pattern.rb
+++ b/app/models/chouette/journey_pattern.rb
@@ -20,6 +20,10 @@ class Chouette::JourneyPattern < Chouette::TridentActiveRecord
attr_accessor :control_checked
after_update :control_route_sections, :unless => "control_checked"
+ def local_id
+ "#{self.route.line.objectid.local_id}-#{self.objectid.local_id}"
+ end
+
def self.state_update route, state
transaction do
state.each do |item|
diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb
index 76905bf2b..81c16f62f 100644
--- a/app/models/chouette/route.rb
+++ b/app/models/chouette/route.rb
@@ -74,6 +74,10 @@ class Chouette::Route < Chouette::TridentActiveRecord
after_commit :journey_patterns_control_route_sections
+ def local_id
+ "#{self.line.objectid.local_id}-#{self.objectid.local_id}"
+ end
+
def geometry_presenter
Chouette::Geometry::RoutePresenter.new self
end
diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb
index 77f51c466..89f221f0a 100644
--- a/app/models/chouette/routing_constraint_zone.rb
+++ b/app/models/chouette/routing_constraint_zone.rb
@@ -6,6 +6,10 @@ class Chouette::RoutingConstraintZone < Chouette::TridentActiveRecord
validates :stop_point_ids, length: { minimum: 2, too_short: I18n.t('activerecord.errors.models.routing_constraint_zone.attributes.stop_points.not_enough_stop_points') }
validate :stop_points_belong_to_route, :not_all_stop_points_selected
+ def local_id
+ "#{self.route.line.objectid.local_id}-#{self.route.objectid.local_id}-#{self.objectid.local_id}"
+ end
+
def stop_points_belong_to_route
errors.add(:stop_point_ids, I18n.t('activerecord.errors.models.routing_constraint_zone.attributes.stop_points.stop_points_not_from_route')) unless stop_points.all? { |sp| route.stop_points.include? sp }
end
diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb
index 2f8188673..38e5cfb88 100644
--- a/app/models/chouette/time_table.rb
+++ b/app/models/chouette/time_table.rb
@@ -26,8 +26,8 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
after_save :save_shortcuts
- def self.object_id_key
- "Timetable"
+ def local_id
+ "#{self.objectid.local_id}"
end
accepts_nested_attributes_for :dates, :allow_destroy => :true
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index bc2713973..3a887744e 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -55,6 +55,10 @@ module Chouette
end
end
+ def local_id
+ "#{self.route.line.objectid.local_id}-#{self.objectid.local_id}"
+ end
+
def set_default_values
if number.nil?
self.number = 0