##// END OF EJS Templates
Remove attachment after transaction commit (#20388)....
Jean-Philippe Lang -
r14248:e045215db7e3
parent child
Show More
@@ -53,7 +53,7 class Attachment < ActiveRecord::Base
53 53 @@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
54 54
55 55 before_create :files_to_final_location
56 after_destroy :delete_from_disk
56 after_commit :delete_from_disk, :on => :destroy
57 57
58 58 # Returns an unsaved copy of the attachment
59 59 def copy(attributes=nil)
@@ -47,6 +47,9 module RedmineApp
47 47 # Do not include all helpers
48 48 config.action_controller.include_all_helpers = false
49 49
50 # Do not supress errors in after_rollback and after_commit callbacks
51 config.active_record.raise_in_transactional_callbacks = true
52
50 53 # XML parameter parser removed from core in Rails 4.0
51 54 # and extracted to actionpack-xml_parser gem
52 55 config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
@@ -23,6 +23,10 class AttachmentTest < ActiveSupport::TestCase
23 23 fixtures :users, :projects, :roles, :members, :member_roles,
24 24 :enabled_modules, :issues, :trackers, :attachments
25 25
26 # TODO: remove this with Rails 5 that supports after_commit callbacks
27 # in transactional fixtures (https://github.com/rails/rails/pull/18458)
28 self.use_transactional_fixtures = false
29
26 30 class MockFile
27 31 attr_reader :original_filename, :content_type, :content, :size
28 32
General Comments 0
You need to be logged in to leave comments. Login now