module Authlogic::Session::Foundation::InstanceMethods

Constants

E_AC_PARAMETERS

Public Class Methods

new(*args) click to toggle source
# File lib/authlogic/session/foundation.rb, line 46
def initialize(*args)
  self.credentials = args
end

Public Instance Methods

credentials() click to toggle source

The credentials you passed to create your session. See credentials= for more info.

# File lib/authlogic/session/foundation.rb, line 52
def credentials
  []
end
credentials=(values) click to toggle source

Set your credentials before you save your session. There are many method signatures.

“` # A hash of credentials is most common session.credentials = { login: “foo”, password: “bar”, remember_me: true }

# You must pass an actual Hash, `ActionController::Parameters` is # specifically not allowed.

# You can pass an array of objects: session.credentials = [my_user_object, true]

# If you need to set an id (see `Authlogic::Session::Id`) pass it # last. It needs 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 => "foo", :password => "bar", :remember_me => true},
:my_id

] session.credentials = [my_user_object, true, :my_id]

# Finally, there's priority_record

{ priority_record: my_object }, :my_id

“`

# File lib/authlogic/session/foundation.rb, line 82
def credentials=(values)
  normalized = Array.wrap(values)
  if normalized.first.class.name == "ActionController::Parameters"
    raise TypeError.new(E_AC_PARAMETERS)
  end
end
inspect() click to toggle source
# File lib/authlogic/session/foundation.rb, line 89
def inspect
  format(
    "#<%s: %s>",
    self.class.name,
    credentials.blank? ? "no credentials provided" : credentials.inspect
  )
end

Private Instance Methods

build_key(last_part) click to toggle source
# File lib/authlogic/session/foundation.rb, line 99
def build_key(last_part)
  last_part
end