]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_way_controller.rb
Enable compression for object history API calls.
[rails.git] / app / controllers / old_way_controller.rb
1 class OldWayController < ApplicationController
2   require 'xml/libxml'
3
4   after_filter :compress_output
5
6   def history
7     begin
8       way = Way.find(params[:id])
9     
10       doc = OSM::API.new.get_xml_doc
11
12       way.old_ways.each do |old_way|
13         doc.root << old_way.to_xml_node
14      end
15
16       render :text => doc.to_s, :content_type => "text/xml"
17     rescue ActiveRecord::RecordNotFound
18       render :nothing => true, :status => :not_found
19     rescue
20       render :nothing => true, :status => :internal_server_error
21     end
22   end
23 end