class AboutNormalHomework < ActiveRecord::Migration def up HomeworkCommon.where(:homework_type => 0).each do |homework| unless homework.homework_detail_manual homework_detail_manual = HomeworkDetailManual.new homework_detail_manual.ta_proportion = 0.6 homework_detail_manual.comment_status = 1 homework_detail_manual.evaluation_start = homework.created_at homework_detail_manual.evaluation_end = homework.created_at homework_detail_manual.evaluation_num = 3 homework_detail_manual.absence_penalty = 5 homework_detail_manual.homework_common_id = homework.id homework_detail_manual.save end end end def down end end