- begin
- way = Way.find(params[:id])
- new_way = Way.from_xml(request.raw_post)
-
- 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 OSM::APIVersionMismatchError => ex
- render :text => "Version mismatch: Provided " + ex.provided.to_s +
- ", server had: " + ex.latest.to_s, :status => :bad_request
- 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})"