class ExerciseShixunAnswer < ApplicationRecord belongs_to :exercise_question belongs_to :user belongs_to :exercise_shixun_challenge has_many :exercise_answer_comments, :dependent => :delete_all # status 0: 未通过, 1:通过 # attr_accessible :answer_text, :score, :status scope :search_shixun_answers, lambda {|name,ids| where("#{name}":ids)} scope :search_shixun_keys, lambda { |name,key| where("#{name} = ?",key)} scope :shixun_no_full_scores, lambda { |score| where("score > 0.0 AND score < ?",score)} scope :score_reviewed, lambda {where("score is not NULL AND score >= ?",0.0)} #是否评分 end