]> git.openstreetmap.org Git - rails.git/blob - app/controllers/way_controller.rb
way stuff
[rails.git] / app / controllers / way_controller.rb
1 class WayController < ApplicationController
2   require 'xml/libxml'
3
4   before_filter :authorize
5
6   def create
7     if request.put?
8       way = Way.from_xml(request.raw_post, true)
9
10       if way
11         way.user_id = @user.id
12         if way.save_with_history
13
14
15           render :text => way.id
16         else
17           render :nothing => true, :status => 500
18         end
19         return
20       else
21         render :nothing => true, :status => 400 # if we got here the doc didnt parse
22         return
23       end
24     end
25
26     render :nothing => true, :status => 500 # something went very wrong
27   end
28
29 end