Fix the segs and tags methods for old_ways so they work.
This commit is contained in:
parent
c184b20f9f
commit
b383517d2b
1 changed files with 12 additions and 1 deletions
|
@ -49,11 +49,22 @@ class OldWay < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def segs
|
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
|
@segs
|
||||||
end
|
end
|
||||||
|
|
||||||
def tags
|
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 = Hash.new unless @tags
|
||||||
@tags
|
@tags
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue