Module: Authlogic::Session::Klass::Config
- Defined in:
- lib/authlogic/session/klass.rb
Instance Method Summary collapse
-
#authenticate_with(klass) ⇒ Object
(also: #authenticate_with=)
Lets you change which model to use for authentication.
-
#klass ⇒ Object
The name of the class that this session is authenticating with.
-
#klass_name ⇒ Object
The string of the model name class guessed from the actual session class name.
Instance Method Details
#authenticate_with(klass) ⇒ Object Also known as: authenticate_with=
Lets you change which model to use for authentication.
-
Default:
inferred from the class name. UserSession would automatically try User -
Accepts:
an ActiveRecord class
21 22 23 24 |
# File 'lib/authlogic/session/klass.rb', line 21 def authenticate_with(klass) @klass_name = klass.name @klass = klass end |
#klass ⇒ Object
The name of the class that this session is authenticating with. For example, the UserSession class will authenticate with the User class unless you specify otherwise in your configuration. See authenticate_with for information on how to change this value.
30 31 32 |
# File 'lib/authlogic/session/klass.rb', line 30 def klass @klass ||= klass_name ? klass_name.constantize : nil end |
#klass_name ⇒ Object
The string of the model name class guessed from the actual session class name.
35 36 37 38 39 |
# File 'lib/authlogic/session/klass.rb', line 35 def klass_name return @klass_name if defined?(@klass_name) @klass_name = name.scan(/(.*)Session/)[0] @klass_name = klass_name ? klass_name[0] : nil end |