E
E
eldar_web2016-02-17 18:33:29
Ruby on Rails
eldar_web, 2016-02-17 18:33:29

Why doesn't Ruby on Rails capture mobile phone logins?

I set up a method in the application controller that will monitor user login and then store it in the database. If you log in from a computer, then it fixes it, but if from mobile phones, then it doesn’t.
How can the problem be solved?

before_action :output_control

  def output_control
    Visit.create(user_id: session[:user_id], browser_client: request.env['HTTP_USER_AGENT'],            ip_client: request.env['REMOTE_ADDR'], date_entrance: DateTime.now, date_output: DateTime.now)
  end

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai, 2016-02-20
@eldar_web

1. Use the create method! In its current form, it may quietly fall on validation or on a not null constraint.
2. Make sure that the mobile phone goes to this route. Yes, at least in the old-fashioned way place puts everywhere - in filters and in action. Options - leans back in any filter, goes to a different url, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question