1 class WayController < ApplicationController
4 before_filter :authorize
5 after_filter :compress_output
9 way = Way.from_xml(request.raw_post, true)
12 way.user_id = @user.id
13 if way.save_with_history
14 render :text => way.id
16 render :nothing => true, :status => 500
20 render :nothing => true, :status => 400 # if we got here the doc didnt parse
25 render :nothing => true, :status => 500 # something went very wrong
29 unless Way.exists?(params[:id])
30 render :nothing => true, :status => 404
34 way = Way.find(params[:id])
39 render :nothing => true, :status => 410
42 render :text => way.to_xml.to_s
46 render :nothing => true, :status => 410
52 render :nothing => true
55 way = Way.from_xml(request.raw_post)
58 way_in_db = Way.find(way.id)
60 way_in_db.user_id = @user.id
61 way_in_db.tags = way.tags
62 way_in_db.segs = way.segs
63 way_in_db.timestamp = way.timestamp
64 way_in_db.visible = true
65 if way_in_db.save_with_history
66 render :text => way.id
68 render :nothing => true, :status => 500
72 render :nothing => true, :status => 404 # way doesn't exist yet
75 render :nothing => true, :status => 400 # if we got here the doc didnt parse
82 response.headers["Content-Type"] = 'application/xml'
83 ids = params['ways'].split(',').collect {|w| w.to_i }
85 waylist = Way.find(ids)
88 doc.root << way.to_xml_node
90 render :text => doc.to_s
92 render :nothing => true, :status => 400