]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_node_controller.rb
ea443216c50e63ecdc05327f73d1e5485adc04f8
[rails.git] / app / controllers / old_node_controller.rb
1 class OldNodeController < ApplicationController
2   require 'xml/libxml'
3
4   before_filter :check_api_readable
5   after_filter :compress_output
6   around_filter :api_call_handle_error, :api_call_timeout
7
8   def history
9     node = Node.find(params[:id])
10     
11     doc = OSM::API.new.get_xml_doc
12     
13     node.old_nodes.each do |old_node|
14       doc.root << old_node.to_xml_node
15     end
16     
17     render :text => doc.to_s, :content_type => "text/xml"
18   end
19   
20   def version
21     if old_node = OldNode.where(:id => params[:id], :version => params[:version]).first
22       response.headers['Last-Modified'] = old_node.timestamp.rfc822
23
24       doc = OSM::API.new.get_xml_doc
25       doc.root << old_node.to_xml_node
26
27       render :text => doc.to_s, :content_type => "text/xml"
28     else
29       render :nothing => true, :status => :not_found
30     end
31   end
32 end