Lets you change which model to use for authentication.
Default:
inferred from the class name. UserSession would
automatically try User
Accepts:
an ActiveRecord class
# File lib/authlogic/session/klass.rb, line 21 def authenticate_with(klass) @klass_name = klass.name @klass = klass end
The string of the model name class guessed from the actual session class name.
# File lib/authlogic/session/klass.rb, line 45 def guessed_klass_name guessed_name = name.scan(%r(.*)Session/)[0] guessed_name[0] if guessed_name end
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.
# File lib/authlogic/session/klass.rb, line 30 def klass @klass ||= if klass_name klass_name.constantize else nil end end
Same as klass, just returns a string instead of the actual constant.
# File lib/authlogic/session/klass.rb, line 40 def klass_name @klass_name ||= guessed_klass_name end