Reputation: 1117
I am using rails for the backend and react for the frontend. I am using rails api only.
I would like to store the current_sign_in_ip
for every user. I am not using devise. How can I achive it.
Upvotes: 1
Views: 274
Reputation: 2659
This will work as well.
request.ip
EDIT
request.ip
is ip detection method provided by Rack::Request
. It looks at the HTTP_X_FORWARDED_FOR header and picks the last one from the list.
Upvotes: 1
Reputation: 6542
request.remote_ip
request.remote_ip
is an interpretation of all the available IP address information and it will make a best-guess. If you access the variables directly you assume responsibility for testing them in the correct precedence order. Proxies introduce a number of headers that create environment variables with different names.
Upvotes: 1