module Geocoder::ActiveRecord::ClassMethods
def near_scope_options(latitude, longitude, radius = 20, options = {})
+select+ :: string with the SELECT SQL fragment (e.g. “id, name”)
+offset+ :: number of records to skip (for OFFSET SQL clause)
+limit+ :: number of records to return (for LIMIT SQL clause)
+order+ :: column(s) for ORDER BY SQL clause
+exclude+ :: an object to exclude (used by the #nearbys method)
+units+ :: :mi (default) or :km
Options hash may include:
records within a radius (in miles) of the given point.
Get options hash suitable for passing to ActiveRecord.find to get
#
def near_scope_options(latitude, longitude, radius = 20, options = {}) radius *= Geocoder::Calculations.km_in_mi if options[:units] == :km if ::ActiveRecord::Base.connection.adapter_name == "SQLite" approx_near_scope_options(latitude, longitude, radius, options) else full_near_scope_options(latitude, longitude, radius, options) end end