1 class NodeController < ApplicationController
4 before_filter :authorize
8 node = Node.from_xml(request.raw_post, true)
11 node.user_id = @user.id
12 if node.save_with_history
14 render :text => node.id
16 render :nothing => true, :status => 500
21 render :nothing => true, :status => 400 # if we got here the doc didnt parse
26 render :nothing => true, :status => 500 # something went very wrong
30 unless Node.exists?(params[:id])
31 render :nothing => true, :status => 400
35 node = Node.find(params[:id])
40 render :text => node.to_xml.to_s
46 node.save_with_history
47 render :nothing => true
49 render :nothing => true, :status => 410
53 new_node = Node.from_xml(request.raw_post)
55 node.timestamp = Time.now
56 node.user_id = @user.id
58 node.latitude = new_node.latitude
59 node.longitude = new_node.longitude
60 node.tags = new_node.tags
62 if node.id == new_node.id and node.save_with_history
63 render :nothing => true, :status => 200
65 render :nothing => true, :status => 500