]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/old_way.rb
way stuff, now creates correctly
[rails.git] / app / models / old_way.rb
index 1aac4ebff8e7736117aa0b8d5e9c0911a1a5b13d..db0108ea8f47232c0754899cb216a653579e4700 100644 (file)
@@ -13,35 +13,27 @@ class OldWay < ActiveRecord::Base
     return old_way
   end
 
-  def save
-    t = Time.now
-    self.timestamp = t
-    self.save
-    
-    WayTag.delete_all(['id = ?', self.id])
+  def save_with_dependencies
+    save()
+    self.reload()
 
     self.tags.each do |k,v|
-      tag = WayTag.new
+      tag = OldWayTag.new
       tag.k = k
       tag.v = v
       tag.id = self.id
+      tag.version = self.version
       tag.save
     end
 
-    WaySegment.delete_all(['id = ?', self.id])
-    
     i = 0
     self.segs.each do |n|
-      seg = WaySegment.new
+      seg = OldWaySegment.new
       seg.id = self.id
       seg.segment_id = n
-      seg.sequence_id = i
+      seg.version = self.version
       seg.save
-      i += 1
     end
-
-    old_way = OldWay.from_way(self)
-    old_way.save
   end
 
   def segs