Sha256: 5037a660b5a5dafe67f70c0e307dee9e41c0a8451b0882fc50ea7b22fabc03c4
Contents?: true
Size: 1.2 KB
Versions: 5
Compression:
Stored size: 1.2 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 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 end end end end
Version data entries
5 entries across 5 versions & 1 rubygems