DaveR
DaveR

Reputation: 2483

Rails Active Storage direct uploads using default storage service instead of service defined in model

I have specified in my model I would like a file to be stored using a non-default service (in this case just a different s3 bucket).

  has_one_attached :video, service: :s3videos

When I submit a standard form everything works. But when I specify that I want direct upload I get a CORS error from my default service, not the one I want. Here's my form field:

<%= f.file_field :video, direct_upload: true %>

Is it the case that direct uploads will always use the default storage - or can I specify the service I want somehow?

Upvotes: 1

Views: 629

Answers (1)

DaveR
DaveR

Reputation: 2483

Looks like this is a known issue and there's a fix in the works!

https://github.com/rails/rails/pull/38957

Upvotes: 1

Related Questions