I want to extract a user country name from visitors\' IP addresses.
I could get the IP address with remote_ip. But what could be the easiest way to get
remote_ip
I'm using this one-liner:
locale = Timeout::timeout(5) { Net::HTTP.get_response(URI.parse('http://api.hostip.info/country.php?ip=' + request.remote_ip )).body } rescue "US"