diff --git a/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb b/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb index 7336fe73c..613f141cf 100644 --- a/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb +++ b/db/migrate/20140604071624_rename_project_id_to_homework_for_courses.rb @@ -4,10 +4,9 @@ class RenameProjectIdToHomeworkForCourses < ActiveRecord::Migration # 作业数据迁移 HomeworkForCourse.all.each do |work| - project = Project.find_by_id(work.project_id) + project = Project.find_by_id(work.course_id) if project && project.project_type == 1 work.course_id = project.course_extra.id - work.project_id = -1 work.save end end