socialforge/db/migrate/20150814024425_change_attac...

14 lines
378 B
Ruby

class ChangeAttachmentTime < ActiveRecord::Migration
def up
Attachment.where("container_type = 'Course'").each do |attachment|
if attachment.container && attachment.container.created_at.to_i > attachment.created_on.to_i
attachment.created_on = attachment.container.created_at + 3600 * 24
attachment.save
end
end
end
def down
end
end