2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2013-05-24 10:48:32 +08:00
|
|
|
class CategoryGroup < ActiveRecord::Base
|
|
|
|
belongs_to :category
|
|
|
|
belongs_to :group
|
2013-07-14 09:24:16 +08:00
|
|
|
|
2015-09-17 15:51:32 +08:00
|
|
|
delegate :name, to: :group, prefix: true
|
|
|
|
|
2013-07-14 09:24:16 +08:00
|
|
|
def self.permission_types
|
2018-04-21 03:25:28 +08:00
|
|
|
@permission_types ||= Enum.new(full: 1, create_post: 2, readonly: 3)
|
2013-07-14 09:24:16 +08:00
|
|
|
end
|
|
|
|
|
2013-05-24 10:48:32 +08:00
|
|
|
end
|
|
|
|
|
2013-05-24 10:35:14 +08:00
|
|
|
# == Schema Information
|
|
|
|
#
|
|
|
|
# Table name: category_groups
|
|
|
|
#
|
2013-07-14 09:24:16 +08:00
|
|
|
# id :integer not null, primary key
|
|
|
|
# category_id :integer not null
|
|
|
|
# group_id :integer not null
|
2014-08-27 13:19:25 +08:00
|
|
|
# created_at :datetime not null
|
|
|
|
# updated_at :datetime not null
|
2013-07-14 09:24:16 +08:00
|
|
|
# permission_type :integer default(1)
|
2013-05-24 10:35:14 +08:00
|
|
|
#
|
2019-10-23 17:30:43 +08:00
|
|
|
# Indexes
|
|
|
|
#
|
|
|
|
# index_category_groups_on_group_id (group_id)
|
|
|
|
#
|