diff options
Diffstat (limited to 'app/models/chouette/stop_point.rb')
| -rw-r--r-- | app/models/chouette/stop_point.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index 42a207774..27407243b 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -46,11 +46,12 @@ module Chouette end end - def duplicate(for_route:) + def duplicate(for_route:, opposite: false) keys_for_create = attributes.keys - %w{id objectid created_at updated_at} atts_for_create = attributes .slice(*keys_for_create) .merge('route_id' => for_route.id) + atts_for_create["position"] = self.route.stop_points.size - atts_for_create["position"] if opposite self.class.create!(atts_for_create) end |
