Class: User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- User
- Defined in:
- app/models/user.rb
Overview
@File Name :role.rb
@Company Name :Mindfire Solutions Pvt. Ltd.
@Creator Name :Indranil Mukherjee
@Date Created :2012-06-04
@Date Modified :2012-06-14
@Last Modification Details :Making it as mcms project standard
@Purpose :The User model is responsible for tracking all the users logics
rules to be imposed on users crud
Instance Method Summary collapse
-
#clean_up_passwords ⇒ Object
@Params : Nothing @Returns : Nothing @Purpose : Cleaning up passwords.
-
#full_name ⇒ Object
@Params : String @Returns : String @Purpose : returns the full name of user.
-
#has_role?(role_title) ⇒ Boolean
@Params : String @Returns : Boolean @Purpose : whether the user has the passed role.
Instance Method Details
#clean_up_passwords ⇒ Object
@Params : Nothing
@Returns : Nothing
@Purpose : Cleaning up passwords
43 44 45 46 47 |
# File 'app/models/user.rb', line 43 def clean_up_passwords self.password = self.password_confirmation = nil end |
#full_name ⇒ Object
@Params : String
@Returns : String
@Purpose : returns the full name of user
89 90 91 |
# File 'app/models/user.rb', line 89 def full_name return sprintf"%s %s", first_name, last_name end |
#has_role?(role_title) ⇒ Boolean
@Params : String
@Returns : Boolean
@Purpose : whether the user has the passed role
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/models/user.rb', line 60 def has_role? role_title if self.roles.present? self.roles.each do |role| if role.title == role_title return true else return false end end else return false end end |