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_answer_comment.rb

12 lines
406 B

class ExerciseAnswerComment < ApplicationRecord
# belongs_to :exercise_answer
belongs_to :user
belongs_to :exercise_question
belongs_to :exercise_shixun_answer, optional: true
belongs_to :exercise_answer, optional: true
scope :search_answer_comments, lambda {|name,ids| where("#{name}":ids)}
validates :comment, length: { maximum: 100, too_long: "不能超过100个字符" }
end