Class: Grandstand::User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Grandstand::User
- Defined in:
- app/models/grandstand/user.rb
Instance Attribute Summary collapse
-
#password ⇒ Object
Returns the value of attribute password.
Class Method Summary collapse
Instance Method Summary collapse
-
#authenticates_with?(check_password) ⇒ Boolean
Check whether or not a given password hashes out to this models’ stored password.
-
#mailto ⇒ Object
Provides a mailto: formatted link to this users’ e-mail address.
-
#name ⇒ Object
Creates a whitespace-cleaned combination of this users’ first and last names.
Instance Attribute Details
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'app/models/grandstand/user.rb', line 4 def password @password end |
Class Method Details
.authenticates_with(credentials) ⇒ Object
20 21 22 23 |
# File 'app/models/grandstand/user.rb', line 20 def authenticates_with(credentials) password = credentials.delete(:password) first(:conditions => credentials) end |
Instance Method Details
#authenticates_with?(check_password) ⇒ Boolean
Check whether or not a given password hashes out to this models’ stored password.
28 29 30 |
# File 'app/models/grandstand/user.rb', line 28 def authenticates_with?(check_password) encrypted_password == password_digest(check_password) end |
#mailto ⇒ Object
Provides a mailto: formatted link to this users’ e-mail address
33 34 35 |
# File 'app/models/grandstand/user.rb', line 33 def mailto "mailto:#{email}" end |
#name ⇒ Object
Creates a whitespace-cleaned combination of this users’ first and last names
39 40 41 42 43 |
# File 'app/models/grandstand/user.rb', line 39 def name return @name if @name name = [first_name, last_name].reject(&:blank?).join(' ') @name = name.blank? ? email : name end |