1 class WayController < ApplicationController
4 before_filter :authorize
8 way = Way.from_xml(request.raw_post, true)
11 way.user_id = @user.id
12 if way.save_with_history
13 render :text => way.id
15 render :nothing => true, :status => 500
19 render :nothing => true, :status => 400 # if we got here the doc didnt parse
24 render :nothing => true, :status => 500 # something went very wrong
28 unless Way.exists?(params[:id])
29 render :nothing => true, :status => 404
33 way = Way.find(params[:id])
38 render :nothing => true, :status => 410
41 render :text => way.to_xml.to_s
45 render :nothing => true, :status => 410
51 render :nothing => true
54 way = Way.from_xml(request.raw_post)
57 way_in_db = Way.find(way.id)
59 way_in_db.user_id = @user.id
60 way_in_db.tags = way.tags
61 way_in_db.segs = way.segs
62 way_in_db.timestamp = way.timestamp
63 way_in_db.visible = true
64 if way_in_db.save_with_history
65 render :text => way.id
67 render :nothing => true, :status => 500
71 render :nothing => true, :status => 404 # way doesn't exist yet
74 render :nothing => true, :status => 400 # if we got here the doc didnt parse