Module: Authlogic::ActsAsAuthentic::MagicColumns::Methods

Defined in:
lib/authlogic/acts_as_authentic/magic_columns.rb

Overview

Methods relating to the magic columns

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/authlogic/acts_as_authentic/magic_columns.rb', line 19

def self.included(klass)
  klass.class_eval do
    if column_names.include?("login_count")
      validates_numericality_of :login_count,
        only_integer: true,
        greater_than_or_equal_to: 0,
        allow_nil: true
    end
    if column_names.include?("failed_login_count")
      validates_numericality_of :failed_login_count,
        only_integer: true,
        greater_than_or_equal_to: 0,
        allow_nil: true
    end
  end
end