educoder/app/models/exercise_question.rb

23 lines
548 B
Ruby

#encoding: utf-8
class ExerciseQuestion < ActiveRecord::Base
include Redmine::SafeAttributes
belongs_to :exercise
has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy
has_many :exercise_answers, :dependent => :destroy
has_many :exercise_standard_answers, :dependent => :destroy
def question_type_name
case self.question_type
when 1
"单选题"
when 2
"多选题"
when 3
"填空题"
when 4
"简答题"
end
end
end