数据迁移

This commit is contained in:
cxt 2016-05-13 20:12:56 +08:00
parent c25b63a254
commit baaff3f988
1 changed files with 2 additions and 2 deletions

View File

@ -4,8 +4,8 @@ class DeleteEmptyApplyHomework < ActiveRecord::Migration
transaction do
for i in 1 ... count do i
ApplyHomework.page(i).per(30).each do |ah|
homework = HomeworkCommon.find ah.homework_common_id
if homework.nil?
homework = HomeworkCommon.where("id = ?",ah.homework_common_id)
if homework.empty?
ah.destroy
end
end