Module: SimpleUserAuth::Model

Defined in:
lib/simple_user_auth.rb

Defined Under Namespace

Modules: ClassInstanceMethods, ClassMethods

Class Method Summary (collapse)

Class Method Details

+ (Object) included(klass)

:nodoc:



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/simple_user_auth.rb', line 26

def self.included(klass) # :nodoc:
  klass.extend(ClassMethods)
  klass.class_eval do
    include ClassInstanceMethods
    class_attribute :authenticator
    attr_accessor :password
    attr_accessor :current_password
    validate :change_password_validator
    validates :password_confirmation, :presence => { :if => :new_record_or_change_password? }
    validates :password,
      :presence     => { :if => :new_record_or_change_password? },
      :confirmation => { :if => :new_record_or_change_password? },
      :length       => { :minimum => 6, :if => :new_record_or_change_password? }
    before_save :encrypt_password   
  end
end