Class: User
- Inherits:
-
Object
- Object
- User
- Includes:
- DmAdapter, MmAdapter, MongoidAdapter, SequelAdapter, TcAdapter
- Defined in:
- lib/models/abstract_user.rb
Class Method Summary collapse
Instance Method Summary collapse
- #db_instance ⇒ Object
- #id ⇒ Object
-
#initialize(interfacing_class_instance) ⇒ User
constructor
A new instance of User.
Methods included from MongoidAdapter
Methods included from SequelAdapter
Methods included from MmAdapter
Methods included from TcAdapter
Methods included from DmAdapter
Constructor Details
#initialize(interfacing_class_instance) ⇒ User
Returns a new instance of User.
36 37 38 |
# File 'lib/models/abstract_user.rb', line 36 def initialize(interfacing_class_instance) @instance = interfacing_class_instance end |
Class Method Details
.authenticate(email, pass) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/models/abstract_user.rb', line 44 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
#db_instance ⇒ Object
51 52 53 |
# File 'lib/models/abstract_user.rb', line 51 def db_instance @instance end |
#id ⇒ Object
40 41 42 |
# File 'lib/models/abstract_user.rb', line 40 def id @instance.id end |