mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-07 21:51:42 +08:00
init project
This commit is contained in:
12
app/models/discipline.rb
Normal file
12
app/models/discipline.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class Discipline < ApplicationRecord
|
||||
default_scope { order(position: :asc) }
|
||||
|
||||
has_many :sub_disciplines, -> { order("sub_disciplines.position ASC") }, dependent: :destroy
|
||||
|
||||
has_many :shixun_sub_disciplines, -> { where("shixun = 1") }, class_name: "SubDiscipline"
|
||||
has_many :subject_sub_disciplines, -> { where("subject = 1") }, class_name: "SubDiscipline"
|
||||
has_many :question_sub_disciplines, -> { where("question = 1") }, class_name: "SubDiscipline"
|
||||
|
||||
validates_presence_of :name
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user