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)
|
||||
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
|
||||
ORDER BY distance
|
||||
LIMIT ?
|
||||
|
|
Loading…
Reference in New Issue