X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/cf304fe60f05f48251a480d19ce3ea9440f8a10e..6ebb7045fe53d831502f054cf5007843e023d094:/app/controllers/way_controller.rb diff --git a/app/controllers/way_controller.rb b/app/controllers/way_controller.rb index a7f74e50c..3f5f66197 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/way_controller.rb @@ -51,20 +51,13 @@ class WayController < ApplicationController new_way = Way.from_xml(request.raw_post) if new_way and new_way.id == way.id - if !new_way.preconditions_ok? - render :text => "", :status => :precondition_failed - else - way.user_id = @user.id - way.tags = new_way.tags - way.nds = new_way.nds - way.visible = true - way.save_with_history! - - render :nothing => true - end + way.update_from(new_way, @user) + render :nothing => true else render :nothing => true, :status => :bad_request end + rescue OSM::APIPreconditionFailedError + render :text => "", :status => :precondition_failed rescue ActiveRecord::RecordNotFound render :nothing => true, :status => :not_found end