+ 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
+ else
+ render :nothing => true, :status => :bad_request
+ end
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => :not_found
+ end
+ end
+
+ # 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
+ end
+ end
+
+ def full
+ begin
+ way = Way.find(params[:id])
+
+ if way.visible
+ nd_ids = way.nds + [-1]
+ nodes = Node.find(:all, :conditions => "visible = 1 AND id IN (#{nd_ids.join(',')})")
+
+ # Render
+ doc = OSM::API.new.get_xml_doc
+ nodes.each do |node|
+ doc.root << node.to_xml_node()