1 class Trace < ActiveRecord::Base
2 set_table_name 'gpx_files'
4 validates_presence_of :user_id, :name, :public, :description, :tmpname, :timestamp
5 validates_numericality_of :latitude, :longitude
6 validates_inclusion_of :inserted, :in => [ true, false]
9 has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :destroy
12 self.tags = s.split().collect {|tag|
19 def large_picture= (data)
20 f = File.new(large_picture_name, "wb")
25 def icon_picture= (data)
26 f = File.new(icon_picture_name, "wb")
32 f = File.new(large_picture_name, "rb")
33 logger.info "large picture file: '#{f.path}', bytes: #{File.size(f.path)}"
34 data = f.sysread(File.size(f.path))
35 logger.info "have read data, bytes: '#{data.length}'"
41 f = File.new(icon_picture_name, "rb")
42 logger.info "icon picture file: '#{f.path}'"
43 data = f.sysread(File.size(f.path))
48 # FIXME change to permanent filestore area
49 def large_picture_name
53 # FIXME change to permanent filestore area