diff --git a/lib/geocoder.rb b/lib/geocoder.rb index 95548ab02bc0cf9668abf8648258b6e7b4dbcf23..9e4fe686f219707bbf0c50105815ad7c2916b691 100644 --- a/lib/geocoder.rb +++ b/lib/geocoder.rb @@ -52,6 +52,7 @@ module Geocoder # +order+ :: column(s) for ORDER BY SQL clause # +limit+ :: number of records to return (for LIMIT SQL clause) # +offset+ :: number of records to skip (for OFFSET SQL clause) + # +select+ :: string with the SELECT SQL fragment (e.g. “id, nameâ€) # def near_scope_options(latitude, longitude, radius = 20, options = {}) if ActiveRecord::Base.connection.adapter_name == "SQLite" @@ -82,7 +83,7 @@ module Geocoder "POWER(SIN((#{longitude} - #{lon_attr}) * " + "PI() / 180 / 2), 2) ))" default_near_scope_options(latitude, longitude, radius, options).merge( - :select => "*, #{distance} AS distance", + :select => "#{options[:select] || '*'}, #{distance} AS distance", :conditions => \ ["#{lat_attr} BETWEEN ? AND ? AND #{lon_attr} BETWEEN ? AND ?"] + coordinate_bounds(latitude, longitude, radius),