From: Nick Burch Date: Sun, 22 Apr 2007 14:46:25 +0000 (+0000) Subject: When calling .tags or .segs on a way, if it's an existing one, use the data from... X-Git-Tag: live~8557 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a926189c7f56e1f2c697f9e46fdbfe41bd730561 When calling .tags or .segs on a way, if it's an existing one, use the data from the database --- diff --git a/app/models/way.rb b/app/models/way.rb index 7dffcfef1..b7d0ec118 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -78,12 +78,22 @@ class Way < ActiveRecord::Base 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 - @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