@@ -47,6 +47,7 class Attachment < ActiveRecord::Base | |||
|
47 | 47 | @@storage_path = Redmine::Configuration['attachments_storage_path'] || "#{Rails.root}/files" |
|
48 | 48 | |
|
49 | 49 | before_save :files_to_final_location |
|
50 | after_destroy :delete_from_disk | |
|
50 | 51 | |
|
51 | 52 | def validate_max_file_size |
|
52 | 53 | if self.filesize > Setting.attachment_max_size.to_i.kilobytes |
@@ -96,7 +97,7 class Attachment < ActiveRecord::Base | |||
|
96 | 97 | end |
|
97 | 98 | |
|
98 | 99 | # Deletes file on the disk |
|
99 | def after_destroy | |
|
100 | def delete_from_disk | |
|
100 | 101 | File.delete(diskfile) if !filename.blank? && File.exist?(diskfile) |
|
101 | 102 | end |
|
102 | 103 |
General Comments 0
You need to be logged in to leave comments.
Login now