yeldarb yeldarb - 7 months ago 33
Ruby Question

What is the purpose of the "system" folder in rails "public/system/"?

The standard place to store non-precompiled public assets in a rails app is in "public/system." Is there any reason for this? I'd like to keep things simple, why shouldn't I just put assets in the "public" folder?


The public/system folder isn't a Rails standard per se or even a documented recommendation. Deployment tools like Capistrano adopted that convention as a suggestion for you to organize user assets that are shared between deployments and shouldn't be in your repository. The idea is symlink public/system to capistrano's shared/system, which is outside of the releases folder.

If you take a look at paperclip's(which is a widely used upload library) docs you'll find:

By default, this location is :rails_root/public/system/:class/:attachment/:id_partition/:style/:filename. This location was chosen because, on standard Capistrano deployments, the public/system directory can be symlinked to the app's shared directory, meaning it survives between deployments.

In your development environment you're supposed to ignore that folder in .gitignore if you're willing to adopt that convention.