Class: Role
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Role
- Defined in:
- app/models/role.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 :This model is required for logic set of role related data
Class Method Summary collapse
-
.fetch_roles(user) ⇒ Object
@Params : Hash @Returns : Array @Purpose : This class method is responsible for fetching an user’s roles.
Class Method Details
.fetch_roles(user) ⇒ Object
@Params : Hash
@Returns : Array
@Purpose : This class method is responsible for fetching an user's roles
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/models/role.rb', line 42 def self.fetch_roles user roles = [] i = 0 if user.present? if user.roles.present? user.roles.each do |user_role| roles[i] = user_role.title i = i + 1 end end end roles # returning the roles array end |