Capitalize radians
This commit is contained in:
parent
9024a70032
commit
d4430ef794
|
@ -7,7 +7,7 @@ class Thing < ActiveRecord::Base
|
||||||
|
|
||||||
def self.find_closest(lat, lng, limit=10)
|
def self.find_closest(lat, lng, limit=10)
|
||||||
query = <<-SQL
|
query = <<-SQL
|
||||||
SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance
|
SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(RADIANS(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance
|
||||||
FROM things
|
FROM things
|
||||||
ORDER BY distance
|
ORDER BY distance
|
||||||
LIMIT ?
|
LIMIT ?
|
||||||
|
|
Loading…
Reference in New Issue