Quick Tip - Get a visitors IP address
Posted by Vince Wadhwani on Feb 10, 2008
A while back I had a tip about getting a user's IP address using Ruby. I'm not exactly sure when it happened but the method I used in that post suddenly stopped working on me. If you used that to get a user's IP address in your code you may find that all values are coming back as 127.0.0.1. Hardly useful. Instead, try this snippet:
<% @ip = request.remote_ip %>