]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/way_controller.rb
Add a capabilities API call. Fixes #410.
[rails.git] / app / controllers / way_controller.rb
index 42219d9b0fce74a0f1be6ed05a4b070d0eecf94d..e7d6cf87b22e9102bacc49b7bdf31d874878f407 100644 (file)
@@ -1,7 +1,9 @@
 class WayController < ApplicationController
   require 'xml/libxml'
 
-  before_filter :authorize, :only => [:create, :update, :destroy]
+  session :off
+  before_filter :authorize, :only => [:create, :update, :delete]
+  before_filter :check_availability, :only => [:create, :update, :delete]
   after_filter :compress_output
 
   def create
@@ -58,7 +60,6 @@ class WayController < ApplicationController
             way.user_id = @user.id
             way.tags = new_way.tags
             way.segs = new_way.segs
-            way.timestamp = new_way.timestamp
             way.visible = true
 
             if way.save_with_history
@@ -86,6 +87,8 @@ class WayController < ApplicationController
 
       if way.visible
         way.user_id = @user.id
+        way.tags = []
+        way.segs = []
         way.visible = false
 
         if way.save_with_history
@@ -139,7 +142,11 @@ class WayController < ApplicationController
   end
 
   def ways
-    ids = params['ways'].split(',').collect { |w| w.to_i }
+    begin
+      ids = params['ways'].split(',').collect { |w| w.to_i }
+    rescue
+      ids = []
+    end
 
     if ids.length > 0
       doc = OSM::API.new.get_xml_doc