X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c11d961f624cb610c4b8184d24e522b2c093d1ea..18453600aa5c208276c7d2f329952642924f4a75:/app/models/old_way.rb diff --git a/app/models/old_way.rb b/app/models/old_way.rb index 062604253..e4df25816 100644 --- a/app/models/old_way.rb +++ b/app/models/old_way.rb @@ -5,6 +5,7 @@ class OldWay < ActiveRecord::Base def self.from_way(way) old_way = OldWay.new + old_way.visible = way.visible old_way.user_id = way.user_id old_way.timestamp = way.timestamp old_way.id = way.id @@ -37,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 @@ -48,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