mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
15d5b7589a
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. |
||
---|---|---|
.. | ||
active_storage | ||
tasks | ||
active_storage.rb |