- begin
- way = Way.find(params[:id])
- way.delete_with_relations_and_history(@user)
-
- # if we get here, all is fine, otherwise something will catch below.
- render :nothing => true
- return
- rescue OSM::APIAlreadyDeletedError
- render :text => "", :status => :gone
- rescue OSM::APIPreconditionFailedError
- render :text => "", :status => :precondition_failed
- rescue ActiveRecord::RecordNotFound
- render :nothing => true, :status => :not_found
+ way = Way.find(params[:id])
+ new_way = Way.from_xml(request.raw_post)
+
+ if new_way and new_way.id == way.id
+ way.delete_with_history!(new_way, @user)
+ render :text => way.version.to_s, :content_type => "text/plain"
+ else
+ render :nothing => true, :status => :bad_request