A user IP is a valuable identifier. IPs generally identify one user–though they may also identify several users behind one network (eg. several employees behind one company firewall). That begs the question–how do you fetch the current user’s IP in Rails?
The answer is in the request variable, which is available for free to all your controllers. You can fetch the current user’s IP from request.env['REMOTE_ADDR'].
What’s more, if you ever need to fake a user IP–such as when testing your IP-blocking code–you can simply set the variable yourself. Fantastic!