Class: User
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
-
#password_confirmation ⇒ Object
Returns the value of attribute password_confirmation.
Class Method Summary collapse
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object (protected)
47 48 49 |
# File 'lib/models/user.rb', line 47 def method_missing(m, *args) return false end |
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/models/user.rb', line 4 def password @password end |
#password_confirmation ⇒ Object
Returns the value of attribute password_confirmation.
4 5 6 |
# File 'lib/models/user.rb', line 4 def password_confirmation @password_confirmation end |
Class Method Details
.authenticate(email, pass) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/models/user.rb', line 17 def self.authenticate(email, pass) current_user = first(: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
#admin? ⇒ Boolean
30 31 32 |
# File 'lib/models/user.rb', line 30 def admin? self. == -1 || self.id == 1 end |