2015-11-13 14:40:14 +08:00
|
|
|
|
class Exercise < ActiveRecord::Base
|
2015-11-13 17:23:52 +08:00
|
|
|
|
#exercise_status: 1,新建;2,发布;3,关闭
|
2015-11-13 14:40:14 +08:00
|
|
|
|
include Redmine::SafeAttributes
|
|
|
|
|
belongs_to :user
|
|
|
|
|
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
|
|
|
|
|
has_many :exercise_users, :dependent => :destroy
|
2015-11-13 15:47:39 +08:00
|
|
|
|
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
|
2015-11-13 14:40:14 +08:00
|
|
|
|
end
|