This commit is contained in:
huang 2015-10-20 09:44:13 +08:00
commit 357c04922a
2 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,23 @@
class UpdateAttachments < ActiveRecord::Migration
def up
count = Attachment.all.count / 30 + 2
transaction do
for i in 1 ... count do i
Attachment.page(i).per(30).each do |attachment|
if attachment.container_type == 'Course'
course = attachment.course
if course
if course.is_public == 0
attachment.is_public = 0
attachment.save
end
end
end
end
end
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151014023806) do ActiveRecord::Schema.define(:version => 20151019085603) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false