segment = Segment.from_xml(request.raw_post, true)
if segment
-
segment.user_id = @user.id
segment.from_node = Node.find(segment.node_a.to_i)
segment.to_node = Node.find(segment.node_b.to_i)
- unless segment.precondtions_ok? # are the nodes visible?
+ unless segment.preconditions_ok? # are the nodes visible?
render :nothing => true, :status => 412
end
if segment.save_with_history
- render :text => segment.id
+ render :text => segment.id.to_s
else
render :nothing => true, :status => 500
end
ids = params['segments'].split(',').collect {|s| s.to_i }
if ids.length > 0
segmentlist = Segment.find(ids)
- doc = get_xml_doc
+ doc = OSM::API.get_xml_doc
segmentlist.each do |segment|
doc.root << segment.to_xml_node
end