Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Defined in:
- app/models/user.rb,
lib/wheels/user.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #confirm! ⇒ Object
- #create_profile ⇒ Object
-
#initialize(*args) ⇒ User
constructor
A new instance of User.
- #role=(role) ⇒ Object
- #role?(role) ⇒ Boolean
Constructor Details
#initialize(*args) ⇒ User
Returns a new instance of User.
13 14 15 |
# File 'app/models/user.rb', line 13 def initialize(*args) super(*args) end |
Class Method Details
Instance Method Details
#confirm! ⇒ Object
55 56 57 58 |
# File 'app/models/user.rb', line 55 def confirm! self.confirmed_at = DateTime::now save end |
#create_profile ⇒ Object
25 26 27 28 29 30 |
# File 'app/models/user.rb', line 25 def create_profile unless self.profile build_profile(:alias=>email) profile.save end end |
#role=(role) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/models/user.rb', line 42 def role=(role) if role.kind_of? Role self.role_id = role.id else role = role.to_s.camelize if role.is_numeric? self.role_id= role else self.role_id= Role.find_by_name(role).id end end end |
#role?(role) ⇒ Boolean
32 33 34 35 36 37 38 39 40 |
# File 'app/models/user.rb', line 32 def role?(role) if role.kind_of?(Role) return role==self.role elsif role.is_numeric? return self.role_id==role else return self.role.name.underscore==role.underscore end end |