class RulingTimerSetting include Mongoid::Document include Mongoid::Timestamps field :role_ids, type: Array, default: [] field :personal_category_id def roles Role.where(:id.in=>self.role_ids) end def authorize?(user) return ((user.member_profile.role_ids.map{|id| id.to_s} & self.role_ids).count != 0) end end