]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_relation_controller.rb
Upgrade to rails 3.1.0
[rails.git] / app / controllers / old_relation_controller.rb
1 class OldRelationController < 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     relation = Relation.find(params[:id])
10     doc = OSM::API.new.get_xml_doc
11     
12     relation.old_relations.each do |old_relation|
13       doc.root << old_relation.to_xml_node
14     end
15     
16     render :text => doc.to_s, :content_type => "text/xml"
17   end
18   
19   def version
20     if old_relation = OldRelation.where(:id => params[:id], :version => params[:version]).first
21       response.last_modified = old_relation.timestamp
22
23       doc = OSM::API.new.get_xml_doc
24       doc.root << old_relation.to_xml_node
25
26       render :text => doc.to_s, :content_type => "text/xml"
27     else
28       render :nothing => true, :status => :not_found
29     end
30   end
31 end