1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activestorage/lib/active_storage
Abhay Nikam 15d5b7589a Fixes ActiveStorage#has_many_attached re-creating destroyed attachment
fixes #41862

ActiveStorage#has_many_attached with `config.active_storage.replace_on_assign_to_many = false`
flag set to flase always appends new attachments to the association.
As mentioned in the issue, if you use nested attributes along with
flag disabled and mark some of the attachment to be `destroyed?`.
The attachment is destroyed but get re-created without blob upload.
This also results in `ActiveStorage#purge_job` failing with rollback.

This PR intends to resolve the issue by checking if the attachment is
persisted when `#save` is invoked. Only persisted and attachment
records are saved which patches the issues.
2021-05-14 20:11:01 +05:30
..
analyzer Fall back to video container for duration 2020-08-31 08:48:06 -04:00
attached Fixes ActiveStorage#has_many_attached re-creating destroyed attachment 2021-05-14 20:11:01 +05:30
previewer Use FFmpeg scene detection for video previews 2020-11-17 17:25:01 -05:00
service Raise a meaningful error if ActiveStorage::Current.host is blank 2021-05-10 17:27:17 +02:00
transformers Remove deprecated support to pass :combine_options operations to ActiveStorage::Transformers::ImageProcessing 2020-10-30 00:25:48 +00:00
analyzer.rb Fix typos [ci skip] 2020-04-22 21:43:37 -07:00
attached.rb
downloader.rb
engine.rb Move ActiveStorage fixture hooks to on_load 2021-01-25 00:36:37 -05:00
errors.rb Active Storage: raise PreviewError when a preview cannot be generated 2021-02-26 14:06:52 -05:00
fixture_set.rb Add docs on how to write tests for using Active Storage [ci skip] 2021-05-06 16:56:53 -05:00
gem_version.rb Rails 6.2 is now Rails 7.0 2021-02-04 16:47:16 +00:00
log_subscriber.rb Mirror direct uploads 2019-05-22 15:07:35 -04:00
previewer.rb Active Storage: raise PreviewError when a preview cannot be generated 2021-02-26 14:06:52 -05:00
reflection.rb Named variants should be defined using block syntax 2020-05-04 13:04:14 +03:00
service.rb Clarify ActiveStorage::Service#url docs [ci skip] 2020-09-12 12:47:33 -04:00
version.rb