Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 641
Brad Borch Avatar asked Oct 03 '16 14:10

Brad Borch


1 Answers

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.

like image 85
Alexandre Angelim Avatar answered Nov 07 '22 17:11

Alexandre Angelim