rails: ActiveStorage direct uploads can't specify a service_name?
hey @DmitryTsepelev – I brought my app to rails master, so that i could try out your PR: https://github.com/rails/rails/pull/34935
unfortunately, I can’t seem to figure out how direct uploads can respect the service specified in the model? DirectUploadsController
doesn’t seem to allow passing in a service (though I’m not sure you’d want that to be user controlled necessarily?). I was expecting somehow for the rails form helpers to somehow signal to the DirectUploadsController
what service to use, based on the model it was posting to.
I’m assuming I’m just missing something, but it seems like there might not be a way to use direct uploads with your PR changes? I guess you could write your own DirectUploadsController
?
Steps to reproduce
use a form_with
in your erb that points to a model, make a file field the same name as a has_one_attached
field and direct_upload: true
. then upload a file via your web browser
Expected behavior
direct upload will be directed at the service specified in the model
Actual behavior
direct upload goes to the default storage adapter
System configuration
Rails version: rails@c1ccc6a0d240
Ruby version: 2.5.1p7
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 6
- Comments: 15 (6 by maintainers)
still not fixed
as a temporary workaround for my app, i implemented my own controller/route for direct uploads:
Still an issue
Still an issue unfortunately
https://github.com/rails/rails/pull/38957 was never merged, so this is still an issue.
It appears the referenced PR was reverted. Was a different fix applied?