When calling .tags or .segs on a way, if it's an existing one, use the data from the database
This commit is contained in:
parent
343e01bb86
commit
a926189c7f
1 changed files with 12 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue