diff options
| author | Zog | 2018-04-04 15:41:37 +0200 | 
|---|---|---|
| committer | Zog | 2018-04-04 15:41:37 +0200 | 
| commit | b7a70ae0cea3221667b4b490dbae8bc0712321b0 (patch) | |
| tree | 12d2ad997f4255ac2a8dfe7ebd58347efcc04f02 /app/models/chouette/stop_point.rb | |
| parent | 23318bbe07b73cef50ec69d5e597386a116e2b82 (diff) | |
| download | chouette-core-b7a70ae0cea3221667b4b490dbae8bc0712321b0.tar.bz2 | |
Refs 6226; Add a button to create opposite routes
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 | 
