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.
trustieforge/db/migrate/20151020013352_update_attac...

24 lines
515 B

class UpdateAttachment < 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