aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/chouette/line.rb3
-rw-r--r--app/models/chouette/route.rb1
-rw-r--r--app/models/chouette/routing_constraint_zone.rb4
3 files changed, 4 insertions, 4 deletions
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb
index 27a37a7f4..50dd9b1b3 100644
--- a/app/models/chouette/line.rb
+++ b/app/models/chouette/line.rb
@@ -20,14 +20,13 @@ class Chouette::Line < Chouette::ActiveRecord
has_many :routes, :dependent => :destroy
has_many :journey_patterns, :through => :routes
has_many :vehicle_journeys, :through => :journey_patterns
+ has_many :routing_constraint_zones, through: :routes
has_and_belongs_to_many :group_of_lines, :class_name => 'Chouette::GroupOfLine', :order => 'group_of_lines.name'
has_many :footnotes, :inverse_of => :line, :validate => :true, :dependent => :destroy
accepts_nested_attributes_for :footnotes, :reject_if => :all_blank, :allow_destroy => true
- has_many :routing_constraint_zones
-
attr_reader :group_of_line_tokens
# validates_presence_of :network
diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb
index 9de7d7470..688f8774e 100644
--- a/app/models/chouette/route.rb
+++ b/app/models/chouette/route.rb
@@ -16,6 +16,7 @@ class Chouette::Route < Chouette::TridentActiveRecord
belongs_to :line
+ has_many :routing_constraint_zones
has_many :journey_patterns, :dependent => :destroy
has_many :vehicle_journeys, :dependent => :destroy do
def timeless
diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb
index 681069416..2c8583ec1 100644
--- a/app/models/chouette/routing_constraint_zone.rb
+++ b/app/models/chouette/routing_constraint_zone.rb
@@ -1,8 +1,8 @@
class Chouette::RoutingConstraintZone < Chouette::TridentActiveRecord
- belongs_to :line
+ belongs_to :route
has_array_of :stop_areas, class_name: 'Chouette::StopArea'
- validates_presence_of :name, :stop_area_ids, :line_id
+ validates_presence_of :name, :stop_area_ids, :route_id
validates :stop_areas, length: { minimum: 2 }
self.primary_key = 'id'