]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_node_controller.rb
Diary entries pretty much i18n'd. Additional test that checks there are no missing...
[rails.git] / app / controllers / old_node_controller.rb
1 class OldNodeController < ApplicationController
2   require 'xml/libxml'
3
4   session :off
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     node = Node.find(params[:id])
11     
12     doc = OSM::API.new.get_xml_doc
13     
14     node.old_nodes.each do |old_node|
15       doc.root << old_node.to_xml_node
16     end
17     
18     render :text => doc.to_s, :content_type => "text/xml"
19   end
20   
21   def version
22     old_node = OldNode.find(:first, :conditions => {:id => params[:id], :version => params[:version]} )
23     if old_node.nil?
24       # (RecordNotFound is not raised with find :first...)
25       render :nothing => true, :status => :not_found
26       return
27     end
28     
29     response.headers['Last-Modified'] = old_node.timestamp.rfc822
30     
31     doc = OSM::API.new.get_xml_doc
32     doc.root << old_node.to_xml_node
33
34     render :text => doc.to_s, :content_type => "text/xml"
35   end
36 end