Set default limit to 40
This commit is contained in:
parent
d8cd38690b
commit
9ea3d90227
|
@ -2,7 +2,7 @@ class ThingsController < ApplicationController
|
|||
respond_to :json
|
||||
|
||||
def show
|
||||
@things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 20)
|
||||
@things = Thing.find_closest(params[:lat], params[:lng], params[:limit] || 40)
|
||||
unless @things.blank?
|
||||
respond_with @things
|
||||
else
|
||||
|
|
|
@ -4,7 +4,7 @@ class Thing < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
has_many :reminders
|
||||
|
||||
def self.find_closest(lat, lng, limit=20)
|
||||
def self.find_closest(lat, lng, limit=40)
|
||||
query = <<-SQL
|
||||
SELECT *, (3959 * ACOS(COS(RADIANS(?)) * COS(RADIANS(lat)) * COS(radians(lng) - RADIANS(?)) + SIN(RADIANS(?)) * SIN(RADIANS(lat)))) AS distance
|
||||
FROM things
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
= select_tag "city_state", "<option value=\"#{t("defaults.city")}\" selected=\"selected\">#{t("defaults.city")}</option>".html_safe, :tabindex => 10
|
||||
= label_tag "address", t("labels.address"), :id => "address_label"
|
||||
= text_field_tag "address", params[:address], :tabindex => 11
|
||||
= hidden_field_tag "limit", params[:limit] || 20
|
||||
= hidden_field_tag "limit", params[:limit] || 40
|
||||
= submit_tag t("buttons.find", :thing => t("defaults.thing").pluralize), :tabindex => 12
|
||||
#logos
|
||||
= image_tag "logos/cfa.png", :alt => t("sponsors.cfa"), :title => t("sponsors.cfa")
|
||||
|
|
Loading…
Reference in New Issue