Class: User

Inherits:
Object
  • Object
show all
Includes:
SlAah
Defined in:
lib/models/scarlet_letters.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SlAah

included

Constructor Details

#initialize(interfacing_class_instance) ⇒ User

Returns a new instance of User.



20
21
22
# File 'lib/models/scarlet_letters.rb', line 20

def initialize(interfacing_class_instance)
  @instance = interfacing_class_instance
end

Class Method Details

.authenticate(email, pass) ⇒ Object



28
29
30
31
32
33
# File 'lib/models/scarlet_letters.rb', line 28

def self.authenticate(email, pass)
  current_user = get(:email => email)
  return nil if current_user.nil?
  return current_user if User.encrypt(pass, current_user.salt) == current_user.hashed_password
  nil
end

Instance Method Details

#idObject



24
25
26
# File 'lib/models/scarlet_letters.rb', line 24

def id
  @instance.id
end