Set default number of hydrants to 100

This commit is contained in:
Erik Michaels-Ober 2011-02-25 16:51:56 -05:00
parent 2210857387
commit b47c198963
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
class Hydrant < ActiveRecord::Base class Hydrant < ActiveRecord::Base
belongs_to :user belongs_to :user
def self.find_closest(lat, lng, limit=20) def self.find_closest(lat, lng, limit=100)
Hydrant.find_by_sql(["SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance FROM hydrants ORDER BY distance LIMIT ?", lat, lng, lat, limit]) Hydrant.find_by_sql(["SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance FROM hydrants ORDER BY distance LIMIT ?", lat, lng, lat, limit])
end end
end end