Where does active storage store files (on disk), and how can I retrieve them physically?
On your local development machine (since you mentioned local disk), you should have a file config/storage.yml
that has a block similar to below:
local:
service: Disk
root: <%= Rails.root.join('storage') %>
In this example above, I'm storing the files in a folder named storage
in the root of my rails application. Inside that folder you'll find nested folders that aren't meant to be navigated via file explorer/Finder (but you can).
Thru your rails app, via views for example, you'd use the url helpers which aren't well documented yet.
From a rails console, you can try, for a model named Foo
, with a has_one_attached :photo
Foo.last.photo.blob.key
It should give you a ~24 character string.
- The first 2 characters are a subfolder inside the folder I pointed you to above
- The next 2 characters are a subfolder inside that
Inside the subfolder is a file with the name that matches the key you printed out above (no extension). That's your file.