]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way.rb
spit out whether the changeset is open in the xml
[rails.git] / app / models / old_way.rb
index bb267dffbfd673ec3b53f0703ce46b348adf9dbf..136e647938122d69a83ed5669521dbe4e64f54ec 100644 (file)
@@ -9,6 +9,7 @@ class OldWay < ActiveRecord::Base
     old_way.user_id = way.user_id
     old_way.timestamp = way.timestamp
     old_way.id = way.id
+    old_way.version = way.version
     old_way.nds = way.nds
     old_way.tags = way.tags
     return old_way
@@ -38,15 +39,13 @@ class OldWay < ActiveRecord::Base
       tag.save!
     end
 
-    i = 1
+    sequence = 1
     self.nds.each do |n|
       nd = OldWayNode.new
-      nd.id = self.id
+      nd.id = [self.id, self.version, sequence]
       nd.node_id = n
-      nd.sequence_id = i
-      nd.version = self.version
       nd.save!
-      i += 1
+      sequence += 1
     end
   end
 
@@ -96,10 +95,11 @@ class OldWay < ActiveRecord::Base
     el1['visible'] = self.visible.to_s
     el1['timestamp'] = self.timestamp.xmlschema
     el1['user'] = self.user.display_name if self.user.data_public?
+    el1['version'] = self.version.to_s
     
     self.old_nodes.each do |nd| # FIXME need to make sure they come back in the right order
       e = XML::Node.new 'nd'
-      e['id'] = nd.node_id.to_s
+      e['ref'] = nd.node_id.to_s
       el1 << e
     end