Module: Authlogic::Session::Cookies::Config
- Defined in:
- lib/novelys_authlogic/session/cookies.rb
Overview
Configuration for the cookie feature set.
Instance Method Summary collapse
-
#cookie_key(value = nil) ⇒ Object
(also: #cookie_key=)
The name of the cookie or the key in the cookies hash.
-
#remember_me(value = nil) ⇒ Object
(also: #remember_me=)
If sessions should be remembered by default or not.
-
#remember_me_for(value = :_read) ⇒ Object
(also: #remember_me_for=)
The length of time until the cookie expires.
Instance Method Details
#cookie_key(value = nil) ⇒ Object Also known as:
The name of the cookie or the key in the cookies hash. Be sure and use a unique name. If you have multiple sessions and they use the same cookie it will cause problems. Also, if a id is set it will be inserted into the beginning of the string. Exmaple:
session = UserSession.new
session. => "user_credentials"
session = UserSession.new(:super_high_secret)
session. => "super_high_secret_user_credentials"
-
Default:
“#Authlogic::Session::Cookies::Config.guessed_klass_nameguessed_klass_name.underscore_credentials” -
Accepts:
String
28 29 30 |
# File 'lib/novelys_authlogic/session/cookies.rb', line 28 def (value = nil) rw_config(:cookie_key, value, "#{guessed_klass_name.underscore}_credentials") end |
#remember_me(value = nil) ⇒ Object Also known as: remember_me=
If sessions should be remembered by default or not.
-
Default:
false -
Accepts:
Boolean
37 38 39 |
# File 'lib/novelys_authlogic/session/cookies.rb', line 37 def remember_me(value = nil) rw_config(:remember_me, value, false) end |
#remember_me_for(value = :_read) ⇒ Object Also known as: remember_me_for=
The length of time until the cookie expires.
-
Default:
3.months -
Accepts:
Integer, length of time in seconds, such as 60 or 3.months
46 47 48 |
# File 'lib/novelys_authlogic/session/cookies.rb', line 46 def remember_me_for(value = :_read) rw_config(:remember_me_for, value, 3.months, :_read) end |