When using Postgres along with the Geocoder gem, your queries cannot use symbolized keys (in this case, :distance
) in the query. Using the string 'distance'
in this case avoids the problem.
@mymodels = MyModel.near(address, distance, order: 'distance')