]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/way.rb
Error if geocoder#search is called with no arguments
[rails.git] / app / models / way.rb
index 34e568e4ab15d407ff052e4fb3526f88209ce48e..6d49735f1406bee653d02783eae58ab076b7e5fc 100644 (file)
@@ -199,7 +199,9 @@ class Way < ActiveRecord::Base
     new_nds = (nds - old_nodes).sort.uniq
 
     unless new_nds.empty?
-      db_nds = Node.where(:id => new_nds, :visible => true)
+      # NOTE: nodes are locked here to ensure they can't be deleted before
+      # the current transaction commits.
+      db_nds = Node.where(:id => new_nds, :visible => true).lock("for share")
 
       if db_nds.length < new_nds.length
         missing = new_nds - db_nds.collect(&:id)