class Lato::ApplicationController

def override_request_remote_ip

For example if the application is behind a nginx proxy the request.remote_ip will be the ip of the proxy and not the ip of the user.
This method is used to get the real ip of the user when the application is behind a proxy.
This method override the request remote ip with the X-Forwarded-For header if exists.
def override_request_remote_ip
  request.remote_ip = request.headers['X-Forwarded-For'] if request.headers['X-Forwarded-For']
end