Reputation: 161
I've been trying to get the user current location with geocoder gem but it crashes in production and returns "nil" everytime.
I've tried with a different IP, another computer, same thing... I've tried to use .safe_location but it's nil too.
Here is my code, just in case:
@location = request.safe_location
unless @location.nil?
@places = Place.near([@location.latitude, @location.longitude])
end
Just for information, I've tried we request.location.city too. Still "no method for nil class".
I've used geocoder on 10 different apps I've coded and never had this problem. It was with Heroku everytime though, first time with AWS.
I am also using geocoder to get Place.near(params[:address]) and that works fine, so I can confirm the gem implementation is fine.
Where could that come from?
Thanks a lot!
Upvotes: 1
Views: 537