From 400b2103540e1dfb370eab29a891687d778ad357 Mon Sep 17 00:00:00 2001 From: George Claghorn Date: Sat, 20 Jul 2019 06:33:11 -0400 Subject: Preserve existing attachment assignment behavior for upgraded apps Assigning to a collection of attachments appends rather than replacing, as in 5.2. Existing 5.2 apps that rely on this behavior will no longer break when they're upgraded to 6.0. For apps generated on 6.0 or newer, assigning replaces the existing attachments in the collection. #attach should be used to add new attachments to the collection without removing existing ones. I expect that we'll deprecate the old behavior in 6.1. Closes #36374. --- guides/source/configuring.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'guides/source/configuring.md') diff --git a/guides/source/configuring.md b/guides/source/configuring.md index e53e8b4e92..4e0224b61e 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -881,7 +881,9 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla config.active_storage.routes_prefix = '/files' ``` - The default is `/rails/active_storage` + The default is `/rails/active_storage`. + +* `config.active_storage.replace_on_assign_to_many` determines whether assigning to a collection of attachments declared with `has_many_attached` replaces any existing attachments or appends to them. The default is `true`. ### Results of `load_defaults` @@ -917,6 +919,7 @@ text/javascript image/svg+xml application/postscript application/x-shockwave-fla - `config.active_job.return_false_on_aborted_enqueue`: `true` - `config.active_storage.queues.analysis`: `:active_storage_analysis` - `config.active_storage.queues.purge`: `:active_storage_purge` +- `config.active_storage.replace_on_assign_to_many`: `true` - `config.active_record.collection_cache_versioning`: `true` ### Configuring a Database -- cgit v1.2.3