课堂增加公告栏模块

dev_aliyun_beta
cxt 6 years ago
parent 392f3f9e19
commit 76210a65dc

@ -0,0 +1,10 @@
class AddAnnouncementToCourseModules < ActiveRecord::Migration[5.2]
def change
Course.all.each do |course|
unless course.course_modules.exists?(module_type: "announcement")
course.course_modules.where.not(module_type: "activity").update_all("position = position + 1")
course.course_modules << CourseModule.new(module_type: "announcement", hidden: 1, module_name: "公告栏", position: 2)
end
end
end
end
Loading…
Cancel
Save