geokit / geokit-rails

Official Geokit plugin for Rails/ActiveRecord. Provides location-based goodness for your Rails app. Requires the Geokit gem.
MIT License
1.57k stars 245 forks source link

session[:geo_location] returns nil #32

Closed blanchma closed 3 years ago

blanchma commented 12 years ago

I added in the top of the controller:

geocode_ip_address

And then:

logger.info "======= GEOLOCATION ===========" logger.info session[:geo_location]

It returns: nil in the logs

mklb commented 10 years ago

Maybe you don´t need an answer anymore but for all other people with the same problem: You need configure your development environment config /config/environments/development.rb

Add this to the bottom of the file and restart your server - otherwise the plugin will use 127.0.0.1 which always returns nil

class ActionDispatch::Request
  def remote_ip
    "XX.XX.XX.XX" # fill in your IP address here
  end
end
ryankopf commented 3 years ago

I am closing all issues that are more than 6 years old now, as the gem has had significant updates and is likely people with these old issues are no longer having the issues. If you are currently still experiencing this issue or need help feel free to submit a new issue, thank you.