]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/amf_controller.rb
Use association names with :joins instead of writing the SQL for the
[rails.git] / app / controllers / amf_controller.rb
index 5ff42fdd2628765f2438e134e2924f99388aeaf3..c175212e2afa0c875789b2ef2e7bc7a691cad102 100644 (file)
@@ -626,7 +626,12 @@ class AmfController < ApplicationController
         new_node = Node.new
         new_node.changeset_id = changeset_id
         new_node.version = v.to_i
-        node.delete_with_history_unless_used!(new_node, user)
+        begin
+          node.delete_with_history!(new_node, user)
+        rescue OSM::APIPreconditionFailedError => ex
+          # We don't do anything here as the node is being used elsewhere
+          # and we don't want to delete it
+        end
       end
 
     end # transaction
@@ -763,7 +768,12 @@ class AmfController < ApplicationController
         new_node = Node.new
         new_node.changeset_id = changeset_id
         new_node.version = v.to_i
-        node.delete_with_history_unless_used!(new_node, user)
+        begin
+          node.delete_with_history!(new_node, user)
+        rescue OSM::APIPreconditionFailedError => ex
+          # We don't do anything with the exception as the node is in use
+          # elsewhere and we don't want to delete it
+        end
       end
 
     end # transaction