]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/relation_controller.rb
split_node_tags:
[rails.git] / app / controllers / relation_controller.rb
index 4f2b12cf5d4cec51e1d1ac54f65898bc4858ad24..f4e938176c214a3d78bb83571d2cfd0400a331e8 100644 (file)
@@ -15,6 +15,7 @@ class RelationController < ApplicationController
         if !relation.preconditions_ok?
           render :text => "", :status => :precondition_failed
         else
+         relation.version = 0
           relation.user_id = @user.id
           relation.save_with_history!
 
@@ -31,7 +32,7 @@ class RelationController < ApplicationController
   def read
     begin
       relation = Relation.find(params[:id])
-
+      response.headers['Last-Modified'] = relation.timestamp.rfc822
       if relation.visible
         render :text => relation.to_xml.to_s, :content_type => "text/xml"
       else
@@ -201,16 +202,12 @@ class RelationController < ApplicationController
   def relations_for_object(objtype)
     relationids = RelationMember.find(:all, :conditions => ['member_type=? and member_id=?', objtype, params[:id]]).collect { |ws| ws.id }.uniq
 
-    if relationids.length > 0
-      doc = OSM::API.new.get_xml_doc
-
-      Relation.find(relationids).each do |relation|
-        doc.root << relation.to_xml_node
-      end
+    doc = OSM::API.new.get_xml_doc
 
-      render :text => doc.to_s, :content_type => "text/xml"
-    else
-      render :nothing => true, :status => :not_found
+    Relation.find(relationids).each do |relation|
+      doc.root << relation.to_xml_node
     end
+
+    render :text => doc.to_s, :content_type => "text/xml"
   end
 end