ruling_timer/app/models/ruling_timer_setting.rb

12 lines
334 B
Ruby

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