Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1: Should File Uploads be added to asset pipeline?

I have a rails 3.1 application that allows users to upload pictures. Should these pictures be stored as assets(in app/assets) and therefore be subject to Sprocket overhead(caching, fingerprinting, etc.)? Or should I keep them in public/images and store them outside of the asset pipeline?

like image 434
dhulihan Avatar asked Sep 12 '11 18:09

dhulihan


People also ask

What does rake assets Clean do?

rake assets:clean Only removes old assets (keeps the most recent 3 copies) from public/assets . Useful when doing rolling deploys that may still be serving old assets while the new ones are being compiled.

What is asset Precompile in rails?

By default, Rails uses CoffeeScript for JavaScript and SCSS for CSS. DHH has a great introduction during his keynote for RailsConf. The Rails asset pipeline provides an assets:precompile rake task to allow assets to be compiled and cached up front rather than compiled every time the app boots.

What is assets Precompile?

rails assets:precompile is the task that does the compilation (concatenation, minification, and preprocessing). When the task is run, Rails first looks at the files in the config.assets.precompile array. By default, this array includes application.js and application.css .


1 Answers

The asset/image is IMHO for structural/design images (background, icons, banners etc). Dynamically added pictures/assets should go in the public directory.

like image 74
charlysisto Avatar answered Nov 16 '22 22:11

charlysisto