rails icon indicating copy to clipboard operation
rails copied to clipboard

[ci skip] Fix documented version for `multiple_file_field_include_hidden`

Open schmijos opened this issue 10 months ago • 3 comments

Rails 6.0 upgrade mentioned that behaviour will change in 7.1 (see https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#active-storage-assignment-behavior-change). But it at least formally did not, see https://guides.rubyonrails.org/7_1_release_notes.html#active-storage-removals

schmijos avatar Apr 10 '24 09:04 schmijos

Ok. Now I am totally confused. Replace started to be default already with 6.0 https://guides.rubyonrails.org/v7.0/configuring.html#config-active-storage-replace-on-assign-to-many

schmijos avatar Apr 10 '24 09:04 schmijos

And I'm even a bit more confused because https://guides.rubyonrails.org/v6.0/configuring.html#config-active-storage-replace-on-assign-to-many doesn't exist.

schmijos avatar Apr 10 '24 09:04 schmijos

Hi @schmijos , maybe the original PR makes more sense? https://github.com/rails/rails/pull/46358

p8 avatar Apr 13 '24 07:04 p8

And I'm even a bit more confused because https://guides.rubyonrails.org/v6.0/configuring.html#config-active-storage-replace-on-assign-to-many doesn't exist.

The direct linking unfortunately wasn't added until later, but the configuration is second to last in the Active Storage section

But it at least formally did not, see https://guides.rubyonrails.org/7_1_release_notes.html#active-storage-removals

I think this note in the link describes the change you are referring to:

Remove deprecated behavior when assigning to a collection of attachments. Instead of appending to the collection, the collection is now replaced.

So the timeline of changes is:

  • new config replace_on_assign_to_many added in 6.0 and set to true with load_defaults 6.0 (https://github.com/rails/rails/commit/400b2103540e1dfb370eab29a891687d778ad357)
  • the configuration was deprecated in 7.0 (https://github.com/rails/rails/commit/61a8cd6c8f9ce864ec9ada95239bfd85f1873f31)
  • the configuration was removed in 7.1 (https://github.com/rails/rails/commit/c720b7eba8bab1d227553ad4f962bf35abd41c88) so now it always replaces

For this PR, my suggestion would be to not mention the version at all. Rails 7.1, 7.2 and main all have the same behavior, which is to replace.

skipkayhil avatar Jul 15 '24 21:07 skipkayhil