Problems with request.remote_ip

Hello everyone,

I am trying to use request.remote_ip in my application to log a user's
IP address because I have been having a lot of abuse issues. basically
when a user logs I simply call user.update_attribute(:last_ip,
request.remote_ip). The problem is that for some reason a lot of people
that have recently logged in still have NULL listed as their last_ip in
the database, even though it properly updates mine when I log in. Why
would request.remote_ip be null, and is there a way that I can at least
get some sort of IP address? I don't understand how request.remote_ip
isn't working when I see the users' IP addresses in my production.log.

If anyone has any ideas please help me out. Thanks!!

it’s request.remote_addr, not request.remote_ip