]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/trace.rb
fixed the ticket 432
[rails.git] / app / models / trace.rb
index aa68d9b9408616784ccf8f60b70573f8f9cdc6cb..2ebf08e85dfed1d3bd37ad3e4666f3b1145bc9de 100644 (file)
@@ -54,4 +54,17 @@ class Trace < ActiveRecord::Base
   def icon_picture_name
     "/tmp/#{id}_icon.gif"
   end
+
+  def to_xml_node
+    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['user'] = self.user.display_name
+    el1['public'] = self.public.to_s
+    el1['pending'] = (!self.inserted).to_s
+    el1['timestamp'] = self.timestamp.xmlschema
+    return el1
+  end
 end