1 # == Schema Information
3 # Table name: gps_points
6 # trackid :integer not null
7 # latitude :integer not null
8 # longitude :integer not null
9 # gpx_id :integer not null
15 # points_gpxid_idx (gpx_id)
16 # points_tile_idx (tile)
20 # gps_points_gpx_id_fkey (gpx_id => gpx_files.id)
23 class Tracepoint < ActiveRecord::Base
26 self.table_name = "gps_points"
28 validates :trackid, :numericality => { :only_integer => true }
29 validates :latitude, :longitude, :numericality => { :only_integer => true }
30 validates :trace, :associated => true
31 validates :timestamp, :presence => true
33 belongs_to :trace, :foreign_key => "gpx_id"
35 def to_xml_node(print_timestamp = false)
36 el1 = XML::Node.new "trkpt"
39 el1 << (XML::Node.new("time") << timestamp.xmlschema) if print_timestamp