Use ActionDispatch::Request#remote_ip instead of reinvent the wheel

http://apidock.com/rails/ActionDispatch/Request/remote_ip

Fixes #4490