]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_way_controller.rb
Remove redundant text.
[rails.git] / app / controllers / old_way_controller.rb
1 class OldWayController < 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     way = Way.find(params[:id])
10     
11     doc = OSM::API.new.get_xml_doc
12     
13     way.old_ways.each do |old_way|
14       doc.root << old_way.to_xml_node
15     end
16     
17     render :text => doc.to_s, :content_type => "text/xml"
18   end
19   
20   def version
21     old_way = OldWay.find(:first, :conditions => {:id => params[:id], :version => params[:version]} )
22     if old_way.nil?
23       # (RecordNotFound is not raised with find :first...)
24       render :nothing => true, :status => :not_found
25       return
26     end
27     
28     response.headers['Last-Modified'] = old_way.timestamp.rfc822
29     
30     doc = OSM::API.new.get_xml_doc
31     doc.root << old_way.to_xml_node
32     
33     render :text => doc.to_s, :content_type => "text/xml"
34   end
35 end