You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/db/migrate/20191029011040_add_statisti...

8 lines
321 B

class AddStatisticsToCourseModule < ActiveRecord::Migration[5.2]
def change
Course.includes(:course_modules).all.each do |course|
CourseModule.create!(course_id: course.id, module_type: "statistics", hidden:0, module_name: "统计", position: course.course_modules.pluck(:position).max + 1)
end
end
end