E
E
eldar_web2015-09-29 11:42:11
Ruby on Rails
eldar_web, 2015-09-29 11:42:11

How to use HTTP_USER_AGENT in Ruby on Rails?

I want to create a table of visits (entry date, exit date, what computer I came from, etc.), and I was told that I would have to use the user agent, but somehow I can’t figure out how to use the user agent and display the values. Will you help?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
eldar_web, 2015-09-29
@eldar_web

You need to use request.env[], and inside the parameters, something like this:

<%= request.env['HTTP_USER_AGENT'] %>
<%= request.env['REMOTE_ADDR'] %>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question