From: Tom Hughes Date: Thu, 9 Sep 2010 23:12:35 +0000 (+0100) Subject: Use last_modified method instead of setting the header manually X-Git-Tag: live~6114 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/986f1c61fa115b7cfd5bef4a108c984da79fec85 Use last_modified method instead of setting the header manually --- diff --git a/app/controllers/node_controller.rb b/app/controllers/node_controller.rb index 33e0ed3ee..19eb77163 100644 --- a/app/controllers/node_controller.rb +++ b/app/controllers/node_controller.rb @@ -26,7 +26,7 @@ class NodeController < ApplicationController def read node = Node.find(params[:id]) if node.visible? - response.headers['Last-Modified'] = node.timestamp.rfc822 + response.last_modified = node.timestamp render :text => node.to_xml.to_s, :content_type => "text/xml" else render :text => "", :status => :gone diff --git a/app/controllers/old_node_controller.rb b/app/controllers/old_node_controller.rb index ea443216c..514e5befe 100644 --- a/app/controllers/old_node_controller.rb +++ b/app/controllers/old_node_controller.rb @@ -19,7 +19,7 @@ class OldNodeController < ApplicationController def version if old_node = OldNode.where(:id => params[:id], :version => params[:version]).first - response.headers['Last-Modified'] = old_node.timestamp.rfc822 + response.last_modified = old_node.timestamp doc = OSM::API.new.get_xml_doc doc.root << old_node.to_xml_node diff --git a/app/controllers/old_relation_controller.rb b/app/controllers/old_relation_controller.rb index 3f4b884f6..0e1950cee 100644 --- a/app/controllers/old_relation_controller.rb +++ b/app/controllers/old_relation_controller.rb @@ -18,7 +18,7 @@ class OldRelationController < ApplicationController def version if old_relation = OldRelation.where(:id => params[:id], :version => params[:version]).first - response.headers['Last-Modified'] = old_relation.timestamp.rfc822 + response.last_modified = old_relation.timestamp doc = OSM::API.new.get_xml_doc doc.root << old_relation.to_xml_node diff --git a/app/controllers/old_way_controller.rb b/app/controllers/old_way_controller.rb index ac1c6cd40..5ea1a0497 100644 --- a/app/controllers/old_way_controller.rb +++ b/app/controllers/old_way_controller.rb @@ -19,7 +19,7 @@ class OldWayController < ApplicationController def version if old_way = OldWay.where(:id => params[:id], :version => params[:version]).first - response.headers['Last-Modified'] = old_way.timestamp.rfc822 + response.last_modified = old_way.timestamp doc = OSM::API.new.get_xml_doc doc.root << old_way.to_xml_node diff --git a/app/controllers/relation_controller.rb b/app/controllers/relation_controller.rb index db68847e5..0c2cccd11 100644 --- a/app/controllers/relation_controller.rb +++ b/app/controllers/relation_controller.rb @@ -26,7 +26,7 @@ class RelationController < ApplicationController def read relation = Relation.find(params[:id]) - response.headers['Last-Modified'] = relation.timestamp.rfc822 + response.last_modified = relation.timestamp if relation.visible render :text => relation.to_xml.to_s, :content_type => "text/xml" else diff --git a/app/controllers/way_controller.rb b/app/controllers/way_controller.rb index f19d6db7d..e20eb1a79 100644 --- a/app/controllers/way_controller.rb +++ b/app/controllers/way_controller.rb @@ -25,7 +25,7 @@ class WayController < ApplicationController def read way = Way.find(params[:id]) - response.headers['Last-Modified'] = way.timestamp.rfc822 + response.last_modified = way.timestamp if way.visible render :text => way.to_xml.to_s, :content_type => "text/xml"