]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/node.rb
Make test for a "zero hour" block more robust
[rails.git] / app / models / node.rb
index 2a64259c10c0832d16c4ec8e2008aa7e34985947..f8559dca75d74431153342f4c4c987281a5354e8 100644 (file)
@@ -232,10 +232,14 @@ class Node < ActiveRecord::Base
 
   def save_with_history!
     t = Time.now.getutc
 
   def save_with_history!
     t = Time.now.getutc
+
+    self.version += 1
+    self.timestamp = t
+
     Node.transaction do
     Node.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!
 
       # Create a NodeTag
       tags = self.tags
 
       # Create a NodeTag
       tags = self.tags