Module: Devise::Models::Timeoutable

Defined in:
lib/devise/models/timeoutable.rb

Overview

Timeoutable takes care of veryfing whether a user session has already expired or not. When a session expires after the configured time, the user will be asked for credentials again, it means, he/she will be redirected to the sign in page.

Configuration:

timeout_in: the time you want to timeout the user session without activity.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



14
15
16
# File 'lib/devise/models/timeoutable.rb', line 14

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#timedout?(last_access) ⇒ Boolean

Checks whether the user session has expired based on configured time.

Returns:

  • (Boolean)


19
20
21
# File 'lib/devise/models/timeoutable.rb', line 19

def timedout?(last_access)
  last_access && last_access <= self.class.timeout_in.ago
end