way stuff, now creates correctly
authorSteve Coast <steve@asklater.com>
Mon, 27 Nov 2006 12:33:20 +0000 (12:33 +0000)
committerSteve Coast <steve@asklater.com>
Mon, 27 Nov 2006 12:33:20 +0000 (12:33 +0000)
app/models/old_way.rb
app/models/old_way_segment.rb
app/models/old_way_tag.rb
app/models/way.rb

index 820437fcefbe0211d66b70992437ad2e6a901626..db0108ea8f47232c0754899cb216a653579e4700 100644 (file)
@@ -14,15 +14,15 @@ class OldWay < ActiveRecord::Base
   end
 
   def save_with_dependencies
-    t = Time.now
-    self.timestamp = t
-    self.save
-    
+    save()
+    self.reload()
+
     self.tags.each do |k,v|
       tag = OldWayTag.new
       tag.k = k
       tag.v = v
       tag.id = self.id
+      tag.version = self.version
       tag.save
     end
 
@@ -31,13 +31,9 @@ class OldWay < ActiveRecord::Base
       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
index 4f96f746909e77e00525fb038e5d521e42e41623..45d1ce009493f44f73c7d9a3132eade3847b2643 100644 (file)
@@ -1,2 +1,6 @@
 class OldWaySegment < ActiveRecord::Base
+  belongs_to :user
+
+  set_table_name 'way_segments'
+
 end
index 7fe61968fd13de1e4d6d4d0ae5fe639512f4b64d..b02fd45b93ad8f23ba3aea7271bcef1ddfce5051 100644 (file)
@@ -1,2 +1,6 @@
 class OldWayTag < ActiveRecord::Base
+  belongs_to :user
+
+  set_table_name 'way_tags'
+
 end
index 55b953ce9439fb40b61c6ea0847b1ca20669733a..a8724456374be2f339933c6201bcb2bdd8277fe2 100644 (file)
@@ -121,6 +121,7 @@ class Way < ActiveRecord::Base
     end
 
     old_way = OldWay.from_way(self)
+    old_way.timestamp = t
     old_way.save_with_dependencies
   end