Sha256: 3327a4c90b910dd91d0f07ee76be457121e90587aba268acfbdd49ee6399a52c
Contents?: true
Size: 533 Bytes
Versions: 31
Compression:
Stored size: 533 Bytes
Contents
class LocationGps < AbstractAdapter belongs_to :location has_many :beacons, through: :location # lat and lng in degrees altitude in meters validates_numericality_of :lat, greater_than_or_equal_to: -90.0, less_than_or_equal_to: 90.0 validates_numericality_of :lng, greater_than_or_equal_to: -180.0, less_than_or_equal_to: 180.0 validates_numericality_of :alt def distance_from(lat,lng) # calc distance between this location and the passed coords Haversine.distance(self.lat,self.lng, lat,lng).to_meters end end
Version data entries
31 entries across 31 versions & 1 rubygems