]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/segment_controller.rb
New way id is now returned complete
[rails.git] / app / controllers / segment_controller.rb
index 048e599c3fb434804dcf79a2c1123d35c56cc3ed..58e98bef224288ec0cb5df3fff45235112f0b23a 100644 (file)
@@ -2,6 +2,7 @@ class SegmentController < ApplicationController
   require 'xml/libxml'
 
   before_filter :authorize
+  after_filter :compress_output
 
   def create
     response.headers["Content-Type"] = 'application/xml'
@@ -12,11 +13,11 @@ class SegmentController < ApplicationController
         
         segment.user_id = @user.id
 
-        a = Node.find(segment.node_a.to_i)
-        b = Node.find(segment.node_b.to_i)
+        segment.from_node = Node.find(segment.node_a.to_i)
+        segment.to_node = Node.find(segment.node_b.to_i)
         
-        unless a and a.visible and b and b.visible  
-          render :nothing => true, :status => 400
+        unless segment.preconditions_ok? # are the nodes visible?
+          render :nothing => true, :status => 412
         end
 
         if segment.save_with_history