-
- if way.visible
- way.user_id = @user.id
- way.tags = []
- way.segs = []
- way.visible = false
- way.save_with_history!
-
- render :nothing => true
- else
- render :nothing => true, :status => :gone
- end
+ 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