Make sure the recorded first point for a trace really is the first
[rails.git] / app / models / tracepoint.rb
1 class Tracepoint < GeoRecord
2   set_table_name 'gps_points'
3
4   validates_numericality_of :trackid, :only_integer => true
5   validates_numericality_of :latitude, :only_integer => true
6   validates_numericality_of :longitude, :only_integer => true
7   validates_associated :trace
8   validates_presence_of :timestamp
9
10   belongs_to :trace, :foreign_key => 'gpx_id'
11
12   def to_xml_node
13     el1 = XML::Node.new 'trkpt'
14     el1['lat'] = self.lat.to_s
15     el1['lon'] = self.lon.to_s
16     return el1
17   end
18 end