scope :tagged, ->(t) { joins(:tags).where(:gpx_file_tags => { :tag => t }) }
validates :user, :presence => true, :associated => true
- validates :name, :presence => true, :length => 1..255
- validates :description, :presence => { :on => :create }, :length => 1..255
+ validates :name, :presence => true, :length => 1..255, :characters => true
+ validates :description, :presence => { :on => :create }, :length => 1..255, :characters => true
validates :timestamp, :presence => true
validates :visibility, :inclusion => %w[private public trackable identifiable]
tp.save!
end
- if gpx.actual_points > 0
+ if gpx.actual_points.positive?
max_lat = Tracepoint.where(:gpx_id => id).maximum(:latitude)
min_lat = Tracepoint.where(:gpx_id => id).minimum(:latitude)
max_lon = Tracepoint.where(:gpx_id => id).maximum(:longitude)