class SubDiscipline < ApplicationRecord belongs_to :discipline has_many :tag_disciplines, dependent: :destroy has_many :shixun_tag_disciplines, -> { where("shixun = 1") }, class_name: "TagDiscipline" has_many :subject_tag_disciplines, -> { where("subject = 1") }, class_name: "TagDiscipline" has_many :question_tag_disciplines, -> { where("question = 1") }, class_name: "TagDiscipline" end