Answer the question
In order to leave comments, you need to log in
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. 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 questionAsk a Question
731 491 924 answers to any question