优化试卷的删除慢

dev_forum
SylorHuang 5 years ago
parent fd9ac84ab5
commit 11c7e95a46

@ -5,11 +5,11 @@ class ExerciseQuestion < ApplicationRecord
belongs_to :shixun, optional: true belongs_to :shixun, optional: true
has_many :exercise_choices, :dependent => :destroy has_many :exercise_choices, :dependent => :destroy
has_many :exercise_answers, :dependent => :destroy has_many :exercise_answers
has_many :exercise_shixun_challenges,:dependent => :destroy has_many :exercise_shixun_challenges,:dependent => :destroy
has_many :exercise_shixun_answers, :dependent => :destroy has_many :exercise_shixun_answers
has_many :exercise_answer_comments, :dependent => :destroy has_many :exercise_answer_comments
has_many :exercise_standard_answers, :dependent => :destroy has_many :exercise_standard_answers
scope :insert_question_ex, lambda {|k| where("question_number > ?",k)} scope :insert_question_ex, lambda {|k| where("question_number > ?",k)}
scope :find_by_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题 scope :find_by_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题

Loading…
Cancel
Save