You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sqm-dashboards/app/models/category.rb

10 lines
273 B

class Category < ApplicationRecord
has_many :questions
belongs_to :parent_category, class_name: 'Category', foreign_key: :parent_category_id
has_many :child_categories, class_name: 'Category', foreign_key: :parent_category_id
validates :name, presence: true
end