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.
educoder/app/models/sub_discipline.rb

14 lines
554 B

class SubDiscipline < ApplicationRecord
belongs_to :discipline
has_many :tag_disciplines, -> { order("tag_disciplines.position ASC") }, dependent: :destroy
has_many :sub_discipline_containers, dependent: :destroy
has_one :hack
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"
validates_presence_of :name
end