blob: 3eafd3399b8de9dfed391d769cf7c99ae5899b40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
class RemoveEolsFromAttachmentsFilename < ActiveRecord::Migration[4.2]
def up
Attachment.where("filename like ? or filename like ?", "%\r%", "%\n%").each do |attachment|
filename = attachment.filename.to_s.tr("\r\n", "_")
Attachment.where(:id => attachment.id).update_all(:filename => filename)
end
end
def down
# nop
end
end
|