]> git.openstreetmap.org Git - rails.git/commitdiff
Fix the segs and tags methods for old_ways so they work.
authorTom Hughes <tom@compton.nu>
Sat, 23 Jun 2007 23:21:35 +0000 (23:21 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 23 Jun 2007 23:21:35 +0000 (23:21 +0000)
app/models/old_way.rb

index d89b2962168de9abf414cf6a5586d5bfa5d23960..3bcdac8896637cc3cae469a3e5de2dce60f693fe 100644 (file)
@@ -49,11 +49,22 @@ class OldWay < ActiveRecord::Base
   end
 
   def segs
-    @segs = Array.new unless @segs
+    unless @segs
+        @segs = Array.new
+        OldWaySegment.find(:all, :conditions => ["id = ? AND version = ?", self.id, self.version], :order => "sequence_id").each do |seg|
+            @segs += [seg.segment_id]
+        end
+    end
     @segs
   end
 
   def tags
+    unless @tags
+        @tags = Hash.new
+        OldWayTag.find(:all, :conditions => ["id = ? AND version = ?", self.id, self.version]).each do |tag|
+            @tags[tag.k] = tag.v
+        end
+    end
     @tags = Hash.new unless @tags
     @tags
   end