diff options
| author | Teddy Wing | 2018-03-13 16:38:12 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2018-03-14 16:42:02 +0100 | 
| commit | 1ce665267da0e303661e28b8f228ccac3823fa36 (patch) | |
| tree | 27d0ea3b6ab50a3a6430c82da5c93223e7b85df6 /app/models | |
| parent | cbb6831b64b0474d5798820c20bdc0f958bd795d (diff) | |
| download | chouette-core-1ce665267da0e303661e28b8f228ccac3823fa36.tar.bz2 | |
Route: Run `#calculate_costs!` on `after_save`
Not efficient to send a request to the TomTom API every time we save a
Route, but I'm banking on developing a cache system soon to avoid having
to make the requests, so hopefully that will stop this from making
expensive remote calls all the time.
Refs #6095
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/chouette/route.rb | 2 | 
1 files changed, 2 insertions, 0 deletions
| diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb index ddc4aece6..f0fe06a58 100644 --- a/app/models/chouette/route.rb +++ b/app/models/chouette/route.rb @@ -75,6 +75,8 @@ module Chouette      validates :wayback, inclusion: { in: self.wayback.values } +    after_save :calculate_costs! +      def duplicate        overrides = {          'opposite_route_id' => nil, | 
