Maxence
Maxence

Reputation: 2339

ActiveStorage for S3 private files

Until now I was using Paperclip for uploading some files to S3. Some of these files are not public and Paperclip allowed to upload some files as private with the following bit :

has_attached_file :image, styles: { large: "2000x2000", small: "1200x1200", thumb: "250x250"}, :s3_permissions => :private

Now Paperclip is deprecated I am considering switching to Active Storage though I have not found any option to make some of my files private.

Is there something to tweak in Active Storage to allow this ?

Upvotes: 4

Views: 1927

Answers (1)

Dinatih
Dinatih

Reputation: 2476

All the files are privates with the default ActiveStorage. If you want to be able to upload some files with public acl (with public url), and others with private acl (with expiring url) you can use my patch here : https://gist.github.com/dinatih/dbfdfd4e84faac4037448a06c9fdc016

from this comment : https://github.com/rails/rails/issues/31419#issuecomment-370900013

Upvotes: 9

Related Questions