]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/old_segment_controller.rb
start of unwayed segments support
[rails.git] / app / controllers / old_segment_controller.rb
index e07026fa46f61883734a16ff62fef7f46040054e..1f64987ed6402f9647ad01bf7f14984cf775741b 100644 (file)
@@ -1,2 +1,20 @@
 class OldSegmentController < ApplicationController
+
+  def history
+    response.headers["Content-Type"] = 'text/xml'
+    segment = Segment.find(params[:id])
+
+    unless segment
+      render :nothing => true, :staus => 404
+      return
+    end
+
+    doc = OSM::API.new.get_xml_doc
+
+    segment.old_segments.each do |old_segment|
+      doc.root << old_segment.to_xml_node
+    end
+
+    render :text => doc.to_s
+  end
 end