diff options
| author | Teddy Wing | 2018-03-15 11:52:16 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-03-15 11:53:39 +0100 | 
| commit | 9291d45e825edbaf52cb556c102498366985496f (patch) | |
| tree | 5097c7510df8cb00dcd4e326ff800f54da7a22b4 /app/models/chouette/route.rb | |
| parent | 9dc7c942fd7e0c0b298bfff08088c830841f666c (diff) | |
| download | chouette-core-9291d45e825edbaf52cb556c102498366985496f.tar.bz2 | |
Route: Don't run `#calculate_costs!` on callback if TomTom disabled
We say `TomTom` is disabled when no API key is present. If this is the
case, the `after_save` callback that uses it shouldn't be executed.
I had to change my `API_KEY` constant to an instance variable to be able
to change it for testing.
Refs #6095
Diffstat (limited to 'app/models/chouette/route.rb')
| -rw-r--r-- | app/models/chouette/route.rb | 2 | 
1 files changed, 1 insertions, 1 deletions
| diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index 4b1b88543..f814d5160 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -75,7 +75,7 @@ module Chouette      validates :wayback, inclusion: { in: self.wayback.values } -    after_save :calculate_costs! +    after_save :calculate_costs!, if: ->() { TomTom.enabled? }      def duplicate        overrides = { | 
