class ExerciseStandardAnswer < ApplicationRecord
  #标准答案
  belongs_to :exercise_question, optional:true
  belongs_to :exercise_choice, optional:true

  scope :find_standard_answer_custom, lambda {|k,v| where("#{k} = ?",v)}  #根据传入的参数查找问题
  scope :standard_by_ids, lambda { |s| where(exercise_choice_id: s) }

  validates :answer_text, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end