2013-04-17 03:08:21 -04:00
|
|
|
class Group < ActiveRecord::Base
|
2013-04-29 02:33:24 -04:00
|
|
|
has_many :category_groups
|
|
|
|
has_many :group_users
|
|
|
|
|
|
|
|
has_many :categories, through: :category_groups
|
|
|
|
has_many :users, through: :group_users
|
|
|
|
|
2013-04-17 03:08:21 -04:00
|
|
|
def self.builtin
|
|
|
|
Enum.new(:moderators, :admins, :trust_level_1, :trust_level_2)
|
|
|
|
end
|
2013-04-29 02:33:24 -04:00
|
|
|
|
|
|
|
def add(user)
|
|
|
|
self.users.push(user)
|
|
|
|
end
|
2013-04-17 03:08:21 -04:00
|
|
|
end
|