I'm on a project where the file upload setup uses Active Storage with Amazon S3. But there's no configuration for me to download files from S3 and use them in development.
When I looked at config/storage.yml I saw the following:
local : service : Disk root : <%= Rails.root.join("storage") %>
Enter fullscreen mode
Exit fullscreen mode
I figured it would be simple, just bring everything inside the S3 Bucket into the app's app/storage folder.
I downloaded the AWS CLI and set it up with my credentials.
Then I synced the S3 files into my app/storage folder:
$ aws s3 sync s3://bucket-name ~/Projects/selected-project/storage
Enter fullscreen mode
Exit fullscreen mode
Started the app and it didn't work 🙄.
In ActiveStorage, when the configured service is Disk, after the blob generates the key, the file is saved inside two folders and then the blob key.
I checked the file path in the console and it returned:
> user = User.first > ActiveStorage::Blob.service.send ( :path_for, u.avatar.key ) =>…