I read the previous close issues #32790 , #32894 . v6.1.0 has added an option for assigning key when attach a file.
but this option is not allowed yet.
has_one_attached :avatar, prefix: 'user/avatars'
When this kind of option will be supported?
I read the previous close issues #32790 , #32894 . v6.1.0 has added an option for assigning key when attach a file.
but this option is not allowed yet.
has_one_attached :avatar, prefix: 'user/avatars'
When this kind of option will be supported?
Hello! Welcome and thanks for moving this conversation over to this list.
I don’t know for sure, but it seems there was no interest in making this feature in Rails and there have been a few workarounds mentioned in those threads for assigning the key as the prefix.
So we really can’t answer the question “when” yet, that ultimately depends on Rails core accepting this feature once someone provides a PR. I think you can still request features here, but someone will have to do the work of creating a patch as well.
I understood. Thanks for your reply.
Same issue here, I was expecting this issue was solved by ActiveStorage rather than the deprecated PaperClip.
If we have many models with attaching objects, Rails Core expects to have all that images in the same folder?
@laranicolas That is my understanding too, ActiveStorage is not meant to provide file organization within the storage service so everything lives at the root of the bucket (in the case of S3).
In my case, I made a buckets only for active_storages, but not everyone can make buckets like me.
I thinks it will be nice if we can use prefixes(optionally) on active_storages
@kikikiblue I don’t want to force you into anything but sometimes the best way to contribute to open-source is to “scratch your own itch” as they say.
If you’re interested in working on a patch for this please let me know! I am happy to help anyone on their way to contributing to Rails!