Sha256: 97da175124129e047a185928082bceafea9da3cad6f567c08c826c8027bf9aaf
Contents?: true
Size: 655 Bytes
Versions: 4
Compression:
Stored size: 655 Bytes
Contents
module ActsAsGeocodable #:nodoc: module RemoteLocation #:nodoc: # Get the remote location of the request IP using http://hostip.info def remote_location if request.remote_ip == '127.0.0.1' # otherwise people would complain that it doesn't work Graticule::Location.new(:locality => 'localhost') else Graticule.service(:host_ip).new.locate(request.remote_ip) end rescue Graticule::Error => e logger.warn "An error occurred while looking up the location of '#{request.remote_ip}': #{e.message}" nil end end end ActionController::Base.send :include, ActsAsGeocodable::RemoteLocation
Version data entries
4 entries across 4 versions & 1 rubygems