- def rest
- unless Way.exists?(params[:id])
- render :nothing => true, :status => 404
- return
+ # This is the API call to delete a way
+ def delete
+ 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
+ rescue OSM::APIAlreadyDeletedError
+ render :text => "", :status => :gone
+ rescue OSM::APIPreconditionFailedError
+ render :text => "", :status => :precondition_failed
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => :not_found