Use last_modified method instead of setting the header manually

This commit is contained in:
Tom Hughes 2010-09-10 00:12:35 +01:00
parent 226c41be69
commit 986f1c61fa
6 changed files with 6 additions and 6 deletions

View file

@ -26,7 +26,7 @@ class NodeController < ApplicationController
def read def read
node = Node.find(params[:id]) node = Node.find(params[:id])
if node.visible? 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" render :text => node.to_xml.to_s, :content_type => "text/xml"
else else
render :text => "", :status => :gone render :text => "", :status => :gone

View file

@ -19,7 +19,7 @@ class OldNodeController < ApplicationController
def version def version
if old_node = OldNode.where(:id => params[:id], :version => params[:version]).first 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 = OSM::API.new.get_xml_doc
doc.root << old_node.to_xml_node doc.root << old_node.to_xml_node

View file

@ -18,7 +18,7 @@ class OldRelationController < ApplicationController
def version def version
if old_relation = OldRelation.where(:id => params[:id], :version => params[:version]).first 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 = OSM::API.new.get_xml_doc
doc.root << old_relation.to_xml_node doc.root << old_relation.to_xml_node

View file

@ -19,7 +19,7 @@ class OldWayController < ApplicationController
def version def version
if old_way = OldWay.where(:id => params[:id], :version => params[:version]).first 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 = OSM::API.new.get_xml_doc
doc.root << old_way.to_xml_node doc.root << old_way.to_xml_node

View file

@ -26,7 +26,7 @@ class RelationController < ApplicationController
def read def read
relation = Relation.find(params[:id]) relation = Relation.find(params[:id])
response.headers['Last-Modified'] = relation.timestamp.rfc822 response.last_modified = relation.timestamp
if relation.visible if relation.visible
render :text => relation.to_xml.to_s, :content_type => "text/xml" render :text => relation.to_xml.to_s, :content_type => "text/xml"
else else

View file

@ -25,7 +25,7 @@ class WayController < ApplicationController
def read def read
way = Way.find(params[:id]) way = Way.find(params[:id])
response.headers['Last-Modified'] = way.timestamp.rfc822 response.last_modified = way.timestamp
if way.visible if way.visible
render :text => way.to_xml.to_s, :content_type => "text/xml" render :text => way.to_xml.to_s, :content_type => "text/xml"