From e1c8a62852616fcfcc6a79b6cc4aefc50e4bd628 Mon Sep 17 00:00:00 2001 From: Michel Etienne Date: Fri, 29 Aug 2014 11:44:05 +0200 Subject: active pagination on remote --- app/models/stop_area_copy.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/models') diff --git a/app/models/stop_area_copy.rb b/app/models/stop_area_copy.rb index 2bd6447ab..39ae42c34 100644 --- a/app/models/stop_area_copy.rb +++ b/app/models/stop_area_copy.rb @@ -14,6 +14,22 @@ class StopAreaCopy def initialize(attributes = {}) attributes.each { |name, value| send("#{name}=", value) } if attributes + if self.area_type.blank? && self.source != nil + self.source_id = self.source.id + if self.hierarchy == "child" + if self.source.area_type.underscore == "stop_place" + self.area_type="commercial_stop_point" + else + self.area_type="boarding_position" + end + else + if self.source.area_type.underscore == "stop_place" || self.source.area_type.underscore == "commercial_stop_point" + self.area_type="stop_place" + else + self.area_type="commercial_stop_point" + end + end + end end def persisted? -- cgit v1.2.3