Rails, Geocoder, and near

Viewed 10627

I'm having a slight issue trying to display certain locations based on proximity to a user. In my controller I have this:

  if User.find(current_user)
    @user = User.find(current_user)
    @locations = Location.near(params[:latitude => @user.latitude, :longitude => @user.longitude], 50, :order => :distance)
  end

Users have a latitude and longitude stored. I'm thinking I've not got the right parameters in the Location.near line, but I can't figure out what they should be.

Any help would be appreciated.

Cheers!

2 Answers
Related