Vote #76578
完了Removing attachment after commit transaction
0%
説明
Now in Attachment model is
after_destroy :delete_from_disk
If you want to construct a serious logic with Rollback this behaviour leads to remove file from disk, but leave an attachment record in DB.
In my project I replaced this callback on
after_commit :delete_from_disk, on: :destroy
and it works perfect.
I think this is a good modification for Redmine. It have full backward compatibility but can extend ability for strong logic in app.
journals
--------------------------------------------------------------------------------
Notice: in Rails 4 appear new config option related with transaction callbacks:
<pre>
config.active_record.raise_in_transactional_callbacks = true
</pre> It allows to propagate errors from transaction callbacks. Preferable to turn it on.
--------------------------------------------------------------------------------
Change committed in r14630, thanks.
--------------------------------------------------------------------------------