diff --git a/app/models/exercise_question.rb b/app/models/exercise_question.rb index 5f456e21f..607ad1a29 100644 --- a/app/models/exercise_question.rb +++ b/app/models/exercise_question.rb @@ -5,11 +5,11 @@ class ExerciseQuestion < ApplicationRecord belongs_to :shixun, optional: true 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_answers, :dependent => :destroy - has_many :exercise_answer_comments, :dependent => :destroy - has_many :exercise_standard_answers, :dependent => :destroy + has_many :exercise_shixun_answers + has_many :exercise_answer_comments + has_many :exercise_standard_answers scope :insert_question_ex, lambda {|k| where("question_number > ?",k)} scope :find_by_custom, lambda {|k,v| where("#{k} = ?",v)} #根据传入的参数查找问题