Module Authlogic::Session::Persistence::ClassMethods
In: lib/authlogic/session/persistence.rb

Methods

find  

Public Instance methods

This is how you persist a session. This finds the record for the current session using a variety of methods. It basically tries to "log in" the user without the user having to explicitly log in. Check out the other Authlogic::Session modules for more information.

The best way to use this method is something like:

  helper_method :current_user_session, :current_user

  def current_user_session
    return @current_user_session if defined?(@current_user_session)
    @current_user_session = UserSession.find
  end

  def current_user
    return @current_user if defined?(@current_user)
    @current_user = current_user_session && current_user_session.user
  end

Also, this method accepts a single parameter as the id, to find session that you marked with an id:

  UserSession.find(:secure)

See the id method for more information on ids.

[Validate]