Module: Authlogic::Session::MagicColumns

Included in:
Base
Defined in:
lib/authlogic/session/magic_columns.rb

Overview

Just like ActiveRecord has “magic” columns, such as: created_at and updated_at. Authlogic has its own “magic” columns too:

Column name           Description
           Increased every time an explicit  is made. This will *NOT* increase if logging in by a session, cookie, or basic http auth
    This increases for each consecutive failed . See Authlogic::Session::BruteForceProtection and the consecutive_failed_logins_limit config option for more details.
last_request_at       Updates every time the user logs in, either by explicitly logging in, or logging in by cookie, session, or http auth
      Updates with the current time when an explicit  is made.
         Updates with the value of  before it is reset.
      Updates with the request remote_ip when an explicit  is made.
         Updates with the value of  before it is reset.

Defined Under Namespace

Modules: Config, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/authlogic/session/magic_columns.rb', line 14

def self.included(klass)
  klass.class_eval do
    extend Config
    include InstanceMethods
    after_persisting :set_last_request_at, :if => :set_last_request_at?
    validate :increase_failed_login_count
    before_save :update_info
    before_save :set_last_request_at, :if => :set_last_request_at?
  end
end