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.
27 lines
705 B
27 lines
705 B
5 years ago
|
class MigrateComModuleResource < ActiveRecord::Migration[5.2]
|
||
|
def change
|
||
|
Competition.all.each do |competition|
|
||
|
competition.competition_modules.each do |com_module|
|
||
|
mod_type = ""
|
||
|
case com_module.name.strip
|
||
|
when '首页'
|
||
|
mod_type = "home"
|
||
|
when '报名'
|
||
|
mod_type = "enroll"
|
||
|
when '通知公告'
|
||
|
mod_type = "inform"
|
||
|
when '参赛手册'
|
||
|
mod_type = "manual"
|
||
|
when '排行榜'
|
||
|
mod_type = "chart"
|
||
|
when '资料下载'
|
||
|
mod_type = "resource"
|
||
|
else
|
||
|
mod_type = "md"
|
||
|
end
|
||
|
com_module.update_attributes!(module_type: mod_type)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|