]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/way_controller.rb
fix indentation. Get teh api version from the constant, rather than hard coding it...
[rails.git] / app / controllers / way_controller.rb
index 17f166ddc85d7c50abd4a7d5ce7424546d259007..6f4704c770c24fae679d72521fc8c94dac0ca930 100644 (file)
@@ -68,10 +68,15 @@ class WayController < ApplicationController
   def delete
     begin
       way = Way.find(params[:id])
-      way.delete_with_history(@user)
+      new_way = Way.from_xml(request.raw_post)
+      if new_way and new_way.id == way.id
+        way.delete_with_history(@user)
 
-      # if we get here, all is fine, otherwise something will catch below.  
-      render :nothing => true
+        # if we get here, all is fine, otherwise something will catch below.  
+        render :nothing => true
+      else
+        render :nothing => true, :status => :bad_request
+      end
     rescue OSM::APIError => ex
       render ex.render_opts
     rescue ActiveRecord::RecordNotFound