I\'m trying to do an order query that finds records nearest to the current_user.
I know the distance between the two points is: current_location.euclidean_distance
current_location.euclidean_distance
Just in case somebody stumbles upon this issue in rails 4. I am using rgeo gem and this works for me
scope :closest, ->(point) { order("ST_Distance(lonlat, ST_GeomFromText('# {point.as_text}', #{SRID}))").limit(5) }