diff options
| author | Zog | 2018-01-26 16:17:22 +0100 |
|---|---|---|
| committer | Zog | 2018-01-26 16:17:22 +0100 |
| commit | 22c38fb750843f0c74996175a6bd17a1f20a943c (patch) | |
| tree | ebf3b2213be01c64b418e0e5b47d1afc860cc962 /app/models/chouette/stop_area.rb | |
| parent | c1da45b2f561ab7ec8d2785bb53f25218e471ce2 (diff) | |
| download | chouette-core-22c38fb750843f0c74996175a6bd17a1f20a943c.tar.bz2 | |
Refs #5750 @1h; Add a "kind" attribute to StopAreas
This determines if the StopArea is commercial or not
The useless fields are hidden in the form for the non-commercials ones
Diffstat (limited to 'app/models/chouette/stop_area.rb')
| -rw-r--r-- | app/models/chouette/stop_area.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb index ea1855ea8..d270a8696 100644 --- a/app/models/chouette/stop_area.rb +++ b/app/models/chouette/stop_area.rb @@ -10,6 +10,7 @@ module Chouette extend Enumerize enumerize :area_type, in: Chouette::AreaType::ALL + enumerize :kind, in: %i(commercial non_commercial) with_options dependent: :destroy do |assoc| assoc.has_many :stop_points @@ -96,6 +97,10 @@ module Chouette end end + def local_id + id.to_s + end + def children_in_depth return [] if self.children.empty? @@ -374,5 +379,9 @@ module Chouette return nil unless time_zone.present? ActiveSupport::TimeZone[time_zone]&.formatted_offset end + + def commercial? + kind == "commercial" + end end end |
