Optionally Return Full Response from Direct Uploads Endpoint #36
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.
Feature
This PR allows a library user to return the entire response from
/rails/active_storage/direct_uploadsin theDirectUploaderProvideronSuccesscallback whenfullAttributesflag is set on theDirectUploadProvider.Example
will log out the full payload returned by the rails active storage endpoint as:
Rationale
I understand that often times the
signedIdis all you need to make an attachment. It is sufficient for most cases. However when multiple files are uploaded, the exact file plus other data data is often needed to create or update records. In this case knowing which particular file the resulting AS upload result refers to is impossible with just thesignedIdand extra contextual information is necessary. By returning the entire payload of the newly createdActiveStorage::Blobrecord, the library user can tie the upload results to specific files.Obviously this is only an issue when multiple files are uploaded and the attachments are not being made all to the same object, but that happens to just the problem I personally have ;).