]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_segment_controller.rb
smarter whichways behaviour, couple of small bugfixes
[rails.git] / app / controllers / old_segment_controller.rb
1 class OldSegmentController < ApplicationController
2   require 'xml/libxml'
3
4   def history
5     begin
6       segment = Segment.find(params[:id])
7
8       doc = OSM::API.new.get_xml_doc
9
10       segment.old_segments.each do |old_segment|
11         doc.root << old_segment.to_xml_node
12       end
13
14      render :text => doc.to_s, :content_type => "text/xml"
15     rescue ActiveRecord::RecordNotFound
16       render :nothing => true, :status => :not_found
17     rescue
18       render :nothing => true, :status => :internal_server_error
19     end
20   end
21 end