]> git.openstreetmap.org Git - rails.git/blob - app/controllers/old_way_controller.rb
Don't give an error when you access the login page when you are logged in. Instead...
[rails.git] / app / controllers / old_way_controller.rb
1 class OldWayController < ApplicationController
2   require 'xml/libxml'
3
4   session :off
5   before_filter :check_read_availability
6   after_filter :compress_output
7
8   def history
9     begin
10       way = Way.find(params[:id])
11     
12       doc = OSM::API.new.get_xml_doc
13
14       way.old_ways.each do |old_way|
15         doc.root << old_way.to_xml_node
16       end
17
18       render :text => doc.to_s, :content_type => "text/xml"
19     rescue ActiveRecord::RecordNotFound
20       render :nothing => true, :status => :not_found
21     rescue
22       render :nothing => true, :status => :internal_server_error
23     end
24   end
25   
26   def version
27     begin
28       old_way = OldWay.find(:first, :conditions => {:id => params[:id], :version => params[:version]} )
29       
30       response.headers['Last-Modified'] = old_way.timestamp.rfc822
31       
32       doc = OSM::API.new.get_xml_doc
33       doc.root << old_way.to_xml_node
34       
35       render :text => doc.to_s, :content_type => "text/xml"
36     rescue ActiveRecord::RecordNotFound
37       render :nothing => true, :status => :not_found
38     rescue
39       render :nothing => true, :status => :internal_server_error
40     end
41   end
42 end