]> git.openstreetmap.org Git - rails.git/commitdiff
When calling .tags or .segs on a way, if it's an existing one, use the data from...
authorNick Burch <openstreetmap@gagravarr.org>
Sun, 22 Apr 2007 14:46:25 +0000 (14:46 +0000)
committerNick Burch <openstreetmap@gagravarr.org>
Sun, 22 Apr 2007 14:46:25 +0000 (14:46 +0000)
app/models/way.rb

index 7dffcfef1886bf456f1610d8bab944b347c36c67..b7d0ec118f92bf3c4e5e239173e7179d842527d3 100644 (file)
@@ -78,12 +78,22 @@ class Way < ActiveRecord::Base
 
 
   def segs
 
 
   def segs
-    @segs = Array.new unless @segs
+    unless @segs
+        @segs = Array.new
+        self.way_segments.each do |seg|
+            @segs += [seg.segment_id]
+        end
+    end
     @segs
   end
 
   def tags
     @segs
   end
 
   def tags
-    @tags = Hash.new unless @tags
+    unless @tags
+        @tags = Hash.new
+        self.way_tags.each do |tag|
+            @tags[tag.k] = tag.v
+        end
+    end
     @tags
   end
 
     @tags
   end