Module: Clearance::Model

Defined in:
lib/clearance/app/models/model.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, ProtectedInstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/clearance/app/models/model.rb', line 4

def self.included(base)
  base.class_eval do
    
    attr_accessible :email, :password, :password_confirmation
    attr_accessor :password, :password_confirmation

    validates_presence_of     :email
    validates_presence_of     :password, :if => :password_required?
    validates_confirmation_of :password, :if => :password_required?
    validates_uniqueness_of   :email

    before_save :initialize_salt, :encrypt_password
    
    extend ClassMethods
    include InstanceMethods
    
  protected

    include ProtectedInstanceMethods
    
  end
end