]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_relation_controller.rb
Mark yet more methods as needing write access to the database
[rails.git] / app / controllers / old_relation_controller.rb
1 class OldRelationController < 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     relation = Relation.find(params[:id])
11     doc = OSM::API.new.get_xml_doc
12     
13     relation.old_relations.each do |old_relation|
14       doc.root << old_relation.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_relation = OldRelation.where(:relation_id => params[:id], :version => params[:version]).first
22       response.last_modified = old_relation.timestamp
23
24       doc = OSM::API.new.get_xml_doc
25       doc.root << old_relation.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