Skip to content

Instantly share code, notes, and snippets.

@Justinwceo
Created December 18, 2011 20:22
Show Gist options
  • Save Justinwceo/1494350 to your computer and use it in GitHub Desktop.
Save Justinwceo/1494350 to your computer and use it in GitHub Desktop.
geocoder
searchable do
string :search_near
location :location do
Sunspot::Util::Coordinates.new(store.latitude, store.longitude) if store
end
end
def search_near
store.address if store
end
q.with(:location).in_radius(*Geocoder.coordinates(params[:search_near]), 100) if params[:search_near].present?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment