Module: Authlogic::Session::Foundation::InstanceMethods
- Defined in:
- lib/authlogic/session/foundation.rb
Instance Method Summary collapse
-
#credentials ⇒ Object
The credentials you passed to create your session.
-
#credentials=(values) ⇒ Object
Set your credentials before you save your session.
- #initialize(*args) ⇒ Object
- #inspect ⇒ Object
- #persisted? ⇒ Boolean
- #to_key ⇒ Object
Instance Method Details
#credentials ⇒ Object
The credentials you passed to create your session. See credentials= for more info.
32 33 34 |
# File 'lib/authlogic/session/foundation.rb', line 32 def credentials [] end |
#credentials=(values) ⇒ Object
Set your credentials before you save your session. You can pass a hash of credentials:
session.credentials = {:login => "my login", :password => "my password", :remember_me => true}
or you can pass an array of objects:
session.credentials = [my_user_object, true]
and if you need to set an id, just pass it last. This value need be the last item in the array you pass, since the id is something that you control yourself, it should never be set from a hash or a form. Examples:
session.credentials = [{:login => "my login", :password => "my password", :remember_me => true}, :my_id]
session.credentials = [my_user_object, true, :my_id]
49 50 |
# File 'lib/authlogic/session/foundation.rb', line 49 def credentials=(values) end |
#initialize(*args) ⇒ Object
27 28 29 |
# File 'lib/authlogic/session/foundation.rb', line 27 def initialize(*args) self.credentials = args end |
#inspect ⇒ Object
52 53 54 |
# File 'lib/authlogic/session/foundation.rb', line 52 def inspect "#<#{self.class.name}: #{credentials.blank? ? "no credentials provided" : credentials.inspect}>" end |
#persisted? ⇒ Boolean
56 57 58 |
# File 'lib/authlogic/session/foundation.rb', line 56 def persisted? !(new_record? || destroyed?) end |
#to_key ⇒ Object
60 61 62 |
# File 'lib/authlogic/session/foundation.rb', line 60 def to_key new_record? ? nil : [ self.send(self.class.primary_key) ] end |