]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_way_controller.rb
Only use SystemTimer on MRI 1.8 as it is superfluous elsewhere
[rails.git] / app / controllers / old_way_controller.rb
1 class OldWayController < ApplicationController
2   require 'xml/libxml'
3
4   skip_before_filter :verify_authenticity_token
5   before_filter :check_api_readable
6   after_filter :compress_output
7   around_filter :api_call_handle_error, :api_call_timeout
8
9   def history
10     way = Way.find(params[:id])
11     
12     doc = OSM::API.new.get_xml_doc
13     
14     way.old_ways.each do |old_way|
15       doc.root << old_way.to_xml_node
16     end
17     
18     render :text => doc.to_s, :content_type => "text/xml"
19   end
20   
21   def version
22     if old_way = OldWay.where(:way_id => params[:id], :version => params[:version]).first
23       response.last_modified = old_way.timestamp
24
25       doc = OSM::API.new.get_xml_doc
26       doc.root << old_way.to_xml_node
27
28       render :text => doc.to_s, :content_type => "text/xml"
29     else
30       render :nothing => true, :status => :not_found
31     end
32   end
33 end