Sha256: a806b4d77970adf1b0cb5a7d6954d8dcd9e09591c27b00463bf53dc8c64c467d

Contents?: true

Size: 1.05 KB

Versions: 14

Compression:

Stored size: 1.05 KB

Contents

module Authlogic
  module ActsAsAuthentic
    # Magic columns are like ActiveRecord's created_at and updated_at columns. They are "magically" maintained for
    # you. Authlogic has the same thing, but these are maintained on the session side. Please see Authlogic::Session::MagicColumns
    # for more details. This module merely adds validations for the magic columns if they exist.
    module MagicColumns
      def self.included(klass)
        klass.class_eval do
          add_acts_as_authentic_module(Methods)
        end
      end

      # Methods relating to the magic columns
      module Methods
        def self.included(klass)
          klass.class_eval do
            validates_numericality_of :login_count, :only_integer => :true, :greater_than_or_equal_to => 0, :allow_nil => true if column_names.include?("login_count")
            validates_numericality_of :failed_login_count, :only_integer => :true, :greater_than_or_equal_to => 0, :allow_nil => true if column_names.include?("failed_login_count")
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
refinerycms-0.9.6.34 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.33 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.32 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.31 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.30 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.29 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.28 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.27 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.26 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.25 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.24 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.23 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.22 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb
refinerycms-0.9.6.21 vendor/plugins/authlogic/lib/authlogic/acts_as_authentic/magic_columns.rb