Class: Collavre::Session

Inherits:
ApplicationRecord show all
Defined in:
app/models/collavre/session.rb

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'app/models/collavre/session.rb', line 7

def expired?
  return false unless Collavre::SystemSetting.session_timeout_enabled?
  return true if last_active_at.nil?

  last_active_at < Collavre::SystemSetting.session_timeout.ago
end

#touch_activity!Object



14
15
16
# File 'app/models/collavre/session.rb', line 14

def touch_activity!
  update_column(:last_active_at, Time.current) if should_touch_activity?
end