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
22 23 24 25 |
# File 'lib/authlogic/session/klass.rb', line 22 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.
32 33 34 |
# File 'lib/authlogic/session/klass.rb', line 32 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.
37 38 39 40 41 |
# File 'lib/authlogic/session/klass.rb', line 37 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 |