添加课程资源内容类型更新脚本

This commit is contained in:
nwb 2014-07-22 10:50:58 +08:00
parent 58c3e98a21
commit 840a7b337b
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
class UpdateCourseAttachment < ActiveRecord::Migration
# 更新课程资源类型
def up
Attachment.all.each do |attachment|
if attachment.container_type == 'Course'
if attachment.attachtype == 1
attachment.attachtype = 4
elsif attachment.attachtype == 2
attachment.attachtype = 5
elsif attachment.attachtype == 3
attachment.attachtype = 6
end
attachment.save
end
end
end
def down
end
end