修复迁移500问题

This commit is contained in:
huang 2017-08-25 20:10:11 +08:00
parent a3ec46c820
commit 290df45c79
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@ class ModifySupportShixunsForMajor < ActiveRecord::Migration
def up
sql = "SELECT distinct(major_id) FROM `major_courses`"
MajorCourse.find_by_sql(sql).each do |mc|
Major.where(:id => mc).update_column(:support_shixuns, 1)
Major.where(:id => mc.try(:major_id)).first.update_column(:support_shixuns, 1)
end
end