How to get my own IP address with Rails?
When I do it like this I got: 127.0.0.1
@ip = request.remote_ip
Is there any way to get the Public IP?
Try:
require 'socket'
ip=Socket.ip_address_list.detect{|intf| intf.ipv4_private?}
ip.ip_address if ip
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With