1

I want detect when a user log in for first time. I know i can do this using Devise, but how do I implement it without Devise?

I know i can set some flag in session, but how can I use it to detect the first time log in? I have the current_user and the user table where I can add one more column such as login_count and I can increment it every time when the user login.

Is it a good idea or is there another way to get the first time login?

4

2 回答 2

4

如果您不想包含 gem,那么更好的主意是保存在记录的列(例如:login_count)中。

设计一个最好的想法来保持sign_in_count

于 2013-07-17T10:40:29.157 回答
0

设计本身sign_in_count在它的用户表上使用一列,这就是它用来检测第一次登录的方法,所以是的,这是一个好主意。

于 2013-07-17T10:38:08.840 回答