Search code examples
ruby-on-railsruby-on-rails-3.2asset-pipelineproduction-environment

Live compilation in Rails production environment for runtime generated images


I'm just starting to deploy my Rails application which generates .png images at runtime (generated by graphviz) and there is no way I can precompile them. Now, I'm trying to figure out this whole assets pipeline issue.

I read on the config.assets.compile=true in Rails production, why not? that live compilation is terrible. Is there any smart way I can handle these assets or will I have to bite the bullet and use live compilation? I can have live compilation turned on only for these runtime generated images and use precompilation for all other assets?


Solution

  • I would put runtime generated images somewhere else, don't try to get them in the asset pipeline. For example I put uploaded images in a shared folder that's outside of the main rails app folder, and symlink it when I deploy (I use capistrano for deployment, and this is a pretty standard setup).

    The asset pipeline is great for ensuring people get the right images / stylesheets / js when you deploy new files, but it doesn't seem appropriate for stuff that will be created at runtime.