diff options
| author | vlatka pavisic | 2016-12-12 15:49:52 +0100 |
|---|---|---|
| committer | vlatka pavisic | 2016-12-12 15:49:58 +0100 |
| commit | 2d4e6b45b0295e8c01deaebb04f8be009a7f9d87 (patch) | |
| tree | efb5139d08a29e9e0c9017b35d34ca8aa611f34d /app/models | |
| parent | 73ab4dfc33dcf6b32198ae902fea3f8504821dea (diff) | |
| download | chouette-core-2d4e6b45b0295e8c01deaebb04f8be009a7f9d87.tar.bz2 | |
Refs #1955 : RoutingConstraintZone
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/chouette/line.rb | 2 | ||||
| -rw-r--r-- | app/models/chouette/routing_constraint_zone.rb | 9 |
2 files changed, 11 insertions, 0 deletions
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb index 3f7a72021..6c5d8501f 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -23,6 +23,8 @@ class Chouette::Line < Chouette::ActiveRecord 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/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb new file mode 100644 index 000000000..681069416 --- /dev/null +++ b/app/models/chouette/routing_constraint_zone.rb @@ -0,0 +1,9 @@ +class Chouette::RoutingConstraintZone < Chouette::TridentActiveRecord + belongs_to :line + has_array_of :stop_areas, class_name: 'Chouette::StopArea' + + validates_presence_of :name, :stop_area_ids, :line_id + validates :stop_areas, length: { minimum: 2 } + + self.primary_key = 'id' +end |
