X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2f55a3f0a80974922678d7677902d169b3481693..a4f4714d0e1b1eeabe5e4b411800b949ef1e1139:/app/models/way.rb diff --git a/app/models/way.rb b/app/models/way.rb index a6e0cecf9..b7d0ec118 100644 --- a/app/models/way.rb +++ b/app/models/way.rb @@ -45,15 +45,8 @@ class Way < ActiveRecord::Base end def to_xml - doc = XML::Document.new - doc.encoding = 'UTF-8' - root = XML::Node.new 'osm' - root['version'] = '0.4' - root['generator'] = 'OpenStreetMap server' - - doc.root = root - - root << to_xml_node() + doc = OSM::API.new.get_xml_doc + doc.root << to_xml_node() return doc end @@ -85,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