2014-04-10 09:55:24 +00:00
|
|
|
class Category
|
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
|
|
|
|
|
|
|
field :disable, type: Boolean, default: false
|
|
|
|
field :title, localize: true
|
|
|
|
|
|
|
|
belongs_to :module_app
|
2014-05-01 07:14:16 +00:00
|
|
|
has_many :authorizations
|
2014-04-10 09:55:24 +00:00
|
|
|
|
|
|
|
scope :enabled, ->{ where(:disable.in => [false, nil, ''])}
|
2014-05-01 07:14:16 +00:00
|
|
|
|
|
|
|
def category_sub_managers
|
|
|
|
Authorization.category_authorized_users(self).pluck(:user_id)
|
|
|
|
end
|
2014-04-10 09:55:24 +00:00
|
|
|
end
|