Module: Workarea::Configuration::Session

Extended by:
Session
Included in:
Session
Defined in:
lib/workarea/configuration/session.rb

Defined Under Namespace

Classes: NoExpirationConfigured

Instance Method Summary collapse

Instance Method Details

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/workarea/configuration/session.rb', line 7

def cookie_store?
  return @cookie_store if defined?(@cookie_store)
  @cookie_store = Rails.application.config.session_store == ActionDispatch::Session::CookieStore
end

#keyObject



12
13
14
# File 'lib/workarea/configuration/session.rb', line 12

def key
  Rails.application.config.session_options[:key]
end

#ttlObject



16
17
18
# File 'lib/workarea/configuration/session.rb', line 16

def ttl
  Rails.application.config.session_options[:expire_after]
end

#validate!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/workarea/configuration/session.rb', line 20

def validate!
  if ttl.blank?
    raise(
      NoExpirationConfigured,
      <<~eos

        Problem:
          Workarea requires a session expiration to be set. We recommend 30 minutes.
        Solution:
          Add `expire_after: 30.minutes` to your session configuration in `config/initializers/session_store.rb`
      eos
    )
  end
end