comparison db/migrate/20130911193200_remove_eols_from_attachments_filename.rb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents
children
comparison
equal deleted inserted replaced
1296:038ba2d95de8 1464:261b3d9a4903
1 class RemoveEolsFromAttachmentsFilename < ActiveRecord::Migration
2 def up
3 Attachment.where("filename like ? or filename like ?", "%\r%", "%\n%").each do |attachment|
4 filename = attachment.filename.to_s.tr("\r\n", "_")
5 Attachment.where(:id => attachment.id).update_all(:filename => filename)
6 end
7 end
8
9 def down
10 # nop
11 end
12 end