It appears that by default, Rails Active Storage nests your file uploads by means of the associated active_storage_blob key.
The rules appear to be as follows for the default behavior. Within the <Rails.root>/storage/ directory:
- take the first two characters of the
keyand make a directory- within that directory, take the next two characters of the
keyand make another directory- store the file there, and the file name is the entire
key
- store the file there, and the file name is the entire
- within that directory, take the next two characters of the
For example: where the key of a particular file's associated active_storage_blob is: 2HadGpe3G4r5ygdgdfh5534346, It would look like the following:
I do not want this nesting behavior. I want to store the files flat within the storage directory. So I simply want it to look like this:
How can I do that? A google search and a read through of the Active Storage Rails Guides didn't reveal a solution.
Also just out of curiosity: why is this the default behavior?

