X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/bb4b682d0b88cfeb207566e328b4eab1a8bda6a3..9738e3f6482972ccf68b9b2e92ad498a31ccb6d8:/app/models/old_way.rb diff --git a/app/models/old_way.rb b/app/models/old_way.rb index d89b29621..e4df25816 100644 --- a/app/models/old_way.rb +++ b/app/models/old_way.rb @@ -38,7 +38,7 @@ class OldWay < ActiveRecord::Base tag.save! end - i = 0 + i = 1 self.segs.each do |n| seg = OldWaySegment.new seg.id = self.id @@ -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