Contains a class method geocode_ip_address which can be used to enable automatic geocoding for request IP addresses. The geocoded information is stored in a cookie and in the session to minimize web service calls. The point of the helper is to enable location-based websites to have a best-guess for new visitors.
Returns the real ip address, though this could be the localhost ip address. No special handling here anymore.
# File /Users/andre/projects/rails/geokit_dev/vendor/plugins/geokit/lib/geokit-rails/ip_geocode_lookup.rb, line 42
42: def get_ip_address
43: request.remote_ip
44: end
Places the IP address’ geocode location into the session if it can be found. Otherwise, looks for a geo location cookie and uses that value. The last resort is to call the web service to get the value.
# File /Users/andre/projects/rails/geokit_dev/vendor/plugins/geokit/lib/geokit-rails/ip_geocode_lookup.rb, line 27
27: def store_ip_location
28: session[:geo_location] ||= retrieve_location_from_cookie_or_service
29: cookies[:geo_location] = { :value => session[:geo_location].to_yaml, :expires => 30.days.from_now } if session[:geo_location]
30: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.