geo_scope
expects only one argument: a hash. You are passing it two arguments: a symbol (:all
) and a hash (:origin=>[zipcode], :within=>10
). It is receiving two arguments when it expects only one, giving you the error:
wrong number of arguments (2 for 1)
There are two ways to solve this.
First, you can remove the :all
symbol and use a finder method:
Bathroom.geo_scope(:origin=>[zipcode], :within=>10).all
Or, you could forget GeoKit altogether and use geocoder instead. (github)
# GeoKit
@bathrooms = Bathroom.geo_scope(:origin=>[zipcode], :within=>10).all
# geocoder
@bathrooms = Bathroom.near(zipcode, 10)