+ segment.from_node = Node.find(segment.node_a.to_i)
+ segment.to_node = Node.find(segment.node_b.to_i)
+
+ if segment.from_node == segment.to_node
+ render :nothing => true, :status => HTTP_EXPECTATION_FAILED
+ return
+ end
+
+ unless segment.preconditions_ok? # are the nodes visible?
+ render :nothing => true, :status => HTTP_PRECONDITION_FAILED
+ end
+
+ if segment.save_with_history
+ render :text => segment.id.to_s