X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/20aa4ba31b61a926c8fcb98f88c02f7d1cbeb655..e6d19586dffa03e6fac4961c0a1b64b6a237d88d:/app/models/way.rb?ds=inline diff --git a/app/models/way.rb b/app/models/way.rb index 98c4902f9..9877b8bb8 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -255,6 +255,9 @@ class Way < ActiveRecord::Base def save_with_history! t = Time.now.getutc + self.version += 1 + self.timestamp = t + # update the bounding box, note that this has to be done both before # and after the save, so that nodes from both versions are included in the # bbox. we use a copy of the changeset so that it isn't reloaded @@ -263,9 +266,9 @@ class Way < ActiveRecord::Base cs.update_bbox!(bbox) unless nodes.empty? Way.transaction do - self.version += 1 - self.timestamp = t - save! + # clone the object before saving it so that the original is + # still marked as dirty if we retry the transaction + clone.save! tags = self.tags WayTag.delete_all(:way_id => id)