Module: Authlogic::ActsAsAuthentic::SessionMaintenance::Config

Defined in:
lib/authlogic/acts_as_authentic/session_maintenance.rb

Overview

Configuration for the session maintenance aspect of acts_as_authentic. These methods become class methods of ::ActiveRecord::Base.

Instance Method Summary collapse

Instance Method Details

#log_in_after_create(value = nil) ⇒ Object Also known as: log_in_after_create=

In order to turn off automatic maintenance of sessions after create, just set this to false.

  • Default: true

  • Accepts: Boolean


42
43
44
# File 'lib/authlogic/acts_as_authentic/session_maintenance.rb', line 42

def (value = nil)
  rw_config(:log_in_after_create, value, true)
end

#log_in_after_password_change(value = nil) ⇒ Object Also known as: log_in_after_password_change=

In order to turn off automatic maintenance of sessions when updating the password, just set this to false.

  • Default: true

  • Accepts: Boolean


52
53
54
# File 'lib/authlogic/acts_as_authentic/session_maintenance.rb', line 52

def (value = nil)
  rw_config(:log_in_after_password_change, value, true)
end

#session_class(value = nil) ⇒ Object Also known as: session_class=

The name of the associated session class. This is inferred by the name of the model.

  • Default: “#Authlogic::ActsAsAuthentic::SessionMaintenance::Config.klassklass.nameSession”.constantize

  • Accepts: Class


74
75
76
77
78
79
80
81
# File 'lib/authlogic/acts_as_authentic/session_maintenance.rb', line 74

def session_class(value = nil)
  const = begin
            "#{base_class.name}Session".constantize
          rescue NameError
            nil
          end
  rw_config(:session_class, value, const)
end

#session_ids(value = nil) ⇒ Object Also known as: session_ids=

As you may know, authlogic sessions can be separate by id (See Authlogic::Session::Base#id). You can specify here what session ids you want auto maintained. By default it is the main session, which has an id of nil.

  • Default: [nil]

  • Accepts: Array


64
65
66
# File 'lib/authlogic/acts_as_authentic/session_maintenance.rb', line 64

def session_ids(value = nil)
  rw_config(:session_ids, value, [nil])
end