Thoughts, information and reflections about technology

Ruby on Rails – Get the IP and Browser of a user

If you need to get the IP of a user, you can  simply use request.remote.ip

           ip = request.remote_ip


If you need to get the user browser, you can use the following
          user_browser request.env[‘HTTP_USER_AGENT’


Of course, the results would be stored in ip and user_browser respectively. 

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact me
Archives
Categories