- begin
- way = Way.find(params[:id])
- new_way = Way.from_xml(request.raw_post)
- if new_way.version != way.version
- render :text => "Version mismatch: Provided " + new_way.version.to_s + ", server had: " + way.version.to_s, :status => :bad_request
- return
- end
-
-
- if new_way and new_way.id == way.id
- way.update_from(new_way, @user)
- render :text => way.version.to_s, :content_type => "text/plain"
- 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
+ way = Way.find(params[:id])
+ new_way = Way.from_xml(request.raw_post)
+
+ unless new_way && new_way.id == way.id
+ raise OSM::APIBadUserInput, "The id in the url (#{way.id}) is not the same as provided in the xml (#{new_way.id})"