Capitalize radians

This commit is contained in:
Erik Michaels-Ober 2012-03-31 05:47:25 -07:00
parent 9024a70032
commit d4430ef794
1 changed files with 1 additions and 1 deletions

View File

@ -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 ?