Include description and tags in GPX details API response

This commit is contained in:
Tom Hughes 2010-10-11 19:10:42 +01:00
parent 1a80a11c4c
commit 9caa2046ca

View file

@ -149,12 +149,23 @@ class Trace < ActiveRecord::Base
el1 = XML::Node.new 'gpx_file'
el1['id'] = self.id.to_s
el1['name'] = self.name.to_s
el1['lat'] = self.latitude.to_s
el1['lon'] = self.longitude.to_s
el1['lat'] = self.latitude.to_s if self.inserted
el1['lon'] = self.longitude.to_s if self.inserted
el1['user'] = self.user.display_name
el1['visibility'] = self.visibility
el1['pending'] = (!self.inserted).to_s
el1['timestamp'] = self.timestamp.xmlschema
el2 = XML::Node.new 'description'
el2 << self.description
el1 << el2
self.tags.each do |tag|
el2 = XML::Node.new('tag')
el2 << tag.tag
el1 << el2
end
return el1
end