rails
rails copied to clipboard
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
Hi @scottjg! I've reproduced the issue and investigating, thanks for catching that!
as a temporary workaround for my app, i implemented my own controller/route for direct uploads:
class DirectVideoUploadsController < ActiveStorage::DirectUploadsController
private
def blob_args
super.merge({
service_name: Rails.env.production? ? :aws_video_input : :aws_video_input_dev,
})
end
end
@scottjg here is a possible fix #38957, could you please take a look when you have a moment?
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 6-0-stable
branch or on master
, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
https://github.com/rails/rails/pull/38957 was never merged, so this is still an issue.
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 6-0-stable
branch or on master
, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
it's still an issue
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails team are limited, and so we are asking for your help.
If you can still reproduce this error on the 6-1-stable
branch or on master
, please reply with all of the information you have about it in order to keep the issue open.
Thank you for all your contributions.
still not fixed
Still an issue unfortunately
Still an issue
https://github.com/rails/rails/pull/38957 is the relevant PR
Closed by #38957
It appears the referenced PR was reverted. Was a different fix applied?
Ack, I didn't read the thread fully, thank you