diff options
| author | Teddy Wing | 2018-03-14 11:02:42 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-03-14 16:42:02 +0100 | 
| commit | 9dc7c942fd7e0c0b298bfff08088c830841f666c (patch) | |
| tree | b0e97293723bc84235aa56297e6280ec149a19e7 /app/models/chouette/route.rb | |
| parent | a5d070093a2561c4924a030338db9064cdff7a16 (diff) | |
| download | chouette-core-9dc7c942fd7e0c0b298bfff08088c830841f666c.tar.bz2 | |
Route#duplicate: Use `#slice!` instead of `#slice`
Johan suggested simplifying this method by changing the `slice` call:
http://api.rubyonrails.org/classes/Hash.html#method-i-slice-21
I had modified this to fix the whitespace while working on the `WayCost`
calculation function for `Chouette::Route`s, so don't really have a
brain cache hit on this code, but the change makes sense and seems to
work.
Refs #6095
Diffstat (limited to 'app/models/chouette/route.rb')
| -rw-r--r-- | app/models/chouette/route.rb | 3 | 
1 files changed, 1 insertions, 2 deletions
| diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 01358e8aa..4b1b88543 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -82,9 +82,8 @@ module Chouette          'opposite_route_id' => nil,          'name' => I18n.t('activerecord.copy', name: self.name)        } -      keys_for_create = attributes.keys - %w{id objectid created_at updated_at}        atts_for_create = attributes -        .slice(*keys_for_create) +        .slice!(*%w{id objectid created_at updated_at})          .merge(overrides)        new_route = self.class.create!(atts_for_create)        duplicate_stop_points(for_route: new_route) | 
