Closed jaydorsey closed 6 months ago
@jaydorsey thank you for contribution!
Regarding the first bullet: extra_context
is a bit redundant and hard to discover for users. It would be much better to just use context
with a reverse_merge
as you wrote. I don't see any danger in that.
Regarding storing structured and contextual metadata on both Cloudinary and Rails would lead to syncing issues (when it is updated on either side and that leads us to an unknown/invalid state). It's up to customer to implement the desired logic.
If I miss something please let me know.
Thanks!
@jaydorsey thank you for contribution!
Regarding the first bullet:
extra_context
is a bit redundant and hard to discover for users. It would be much better to just usecontext
with areverse_merge
as you wrote. I don't see any danger in that.
I agree, this does sound better.
Regarding storing structured and contextual metadata on both Cloudinary and Rails would lead to syncing issues (when it is updated on either side and that leads us to an unknown/invalid state). It's up to customer to implement the desired logic.
This also makes sense.
I updated my PR to try and reflect these changes. I also setup my system to be able to run the full test suite and the entire suite is green
@jaydorsey thank you for contribution!
Brief Summary of Changes
Cloudinary has support for contextual metadata but it doesn't appear to be supported as an option during
ActiveStorage::Service#url_for_direct_upload
.I want to send additional context to cloudinary when I generate the URL for direct upload, using active storage.
Example:
Creates this on cloudinary:
What does this PR address?
Are tests included?
Reviewer, please note:
extra_context
key so it wouldn't collide with anything that I might have overlooked. We might be able to just usecontext
with areverse_merge
of the active storage key and remove theextra_context
option/keycustom
key in themetadata
field.#metadata[:custom][:structured]
and#metadata[:custom][:contextual]
makes sense in my headChecklist: