class CompanyCategory < ApplicationRecord
  include Base::CompanyCategory

  default_scope { where(type: 2) }

  associations_for legacy: true do |a|
    a.belongs_to :school
  end

  belongs_to :group, class_name: 'CompanyCategoryGroup', foreign_key: :CCGID,
    inverse_of: :categories, optional: true, counter_cache: :categories_count

  validates :name, presence: true, length: { maximum: 32 }
  validates :description, length: { maximum: 128 }
end
