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/exercise_standard_answer.rb

11 lines
353 B

6 years ago
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) }
end