Module: Devise::Models::Stalkable
- Defined in:
- lib/devise/models/stalkable.rb
Instance Method Summary collapse
-
#mark_last_seen!(login_record_id) ⇒ Object
Marks the time when the user was last seen in the system on a given login record ID.
-
#mark_login!(request) ⇒ UserLogin
Creates a new login record based on information in provided request object.
-
#mark_logout!(login_record_id) ⇒ Object
Marks the time when user has logged out on given login record ID.
Instance Method Details
#mark_last_seen!(login_record_id) ⇒ Object
Marks the time when the user was last seen in the system on a given login record ID.
22 23 24 25 |
# File 'lib/devise/models/stalkable.rb', line 22 def mark_last_seen!(login_record_id) login_record = login_class.find(login_record_id) login_record.update_column :last_seen_at, Time.now end |
#mark_login!(request) ⇒ UserLogin
Creates a new login record based on information in provided request object. Marks the last seen time as well.
to login
14 15 16 |
# File 'lib/devise/models/stalkable.rb', line 14 def mark_login!(request) login_class.create(attrs_for_login(request)) end |
#mark_logout!(login_record_id) ⇒ Object
Marks the time when user has logged out on given login record ID. Marks the last seen time as well.
31 32 33 34 35 36 |
# File 'lib/devise/models/stalkable.rb', line 31 def mark_logout!(login_record_id) login_record = login_class.find(login_record_id) t = Time.now login_record.update_column :last_seen_at, t login_record.update_column :signed_out_at, t end |