From 5bd1cdc4eb20464bf37aee1747e2e2630d415074 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 22 Jul 2015 10:06:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E7=A8=8B=E4=BD=9C=E4=B8=9A=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E7=9A=84=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 1 + app/models/student_work_test.rb | 2 +- .../20150722015428_add_errormsg_to_studen_work_test.rb | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 209fa7269..e885a780a 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -396,6 +396,7 @@ class StudentWorkController < ApplicationController if student_work_test.result == 0 student_score_count += 1 end + student_work_test.error_msg = params[:compile_error_msg] student_work_test.save! end end diff --git a/app/models/student_work_test.rb b/app/models/student_work_test.rb index 2e6efdf0a..413528b82 100644 --- a/app/models/student_work_test.rb +++ b/app/models/student_work_test.rb @@ -1,6 +1,6 @@ # encoding: utf-8 class StudentWorkTest < ActiveRecord::Base - attr_accessible :student_work_id, :homework_test_id, :result + attr_accessible :student_work_id, :homework_test_id, :result, :error_msg belongs_to :homework_test belongs_to :student_work diff --git a/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb new file mode 100644 index 000000000..e3f0611db --- /dev/null +++ b/db/migrate/20150722015428_add_errormsg_to_studen_work_test.rb @@ -0,0 +1,9 @@ +class AddErrormsgToStudenWorkTest < ActiveRecord::Migration + def up + add_column :student_work_tests,:error_msg,:text + end + + def down + remove_column :student_work_tests,:error_msg, + end +end