4821-part1-partner-profile-support-multiple-attached-docs #5035
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partial solution for #4821
Description
This is the first part in a series of planned improvements for the "Additional Documents" section of Partner Profile editing.
Currently, even though the field is named in the plural "Additional Documents" and is using the
has_many_attached
association, in practice, the partner can only ever have one document at a time. Any time they upload a new one, it removes whatever was there previously.What this fixes is to maintain the existing document(s), when a new one is uploaded, by including a hidden
signed_id
field for every document that is already attached. This solution is explained in the Rails Guide on Active Storage.Note
This is only implemented in the step-wise version of the Partner Profile edit form as the legacy "all-in-one" version is no longer in use (and should eventually be retired - future ticket).
Type of change
How Has This Been Tested?
For automated testing, see new system test
spec/system/partners/profile_edit_system_spec.rb
"preserves previously uploaded documents when adding new attachments".For manual testing:
[email protected]
Screenshots