summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-01-21 05:38:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-01-21 05:38:55 +0000
commit3ffdc863dec492808e3f05c8bd0e0e4df44650d6 (patch)
tree6a32c24fba9b7caa3bf919531c5b8e3b91f7875a /app/models
parentaa490a70b3ddd1e99a8910bf133d164e0a218020 (diff)
downloadredmine-3ffdc863dec492808e3f05c8bd0e0e4df44650d6.tar.gz
redmine-3ffdc863dec492808e3f05c8bd0e0e4df44650d6.zip
Removes attachment from disk after rollback on create (#21125).
git-svn-id: http://svn.redmine.org/redmine/trunk@15085 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/attachment.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 0064555b9..3fde84a78 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -53,6 +53,7 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_create :files_to_final_location
+ after_rollback :delete_from_disk, :on => :create
after_commit :delete_from_disk, :on => :destroy
# Returns an unsaved copy of the attachment