Pregunta

I have a question relating to how precompiled assets are utilized in a production environment. What about general file attachments as a part of the model? For example, I have the model "Event". You can have n attachments to the model, and they can be any file you want. Typically they are either image files or PDF files, but they can also be Excel files for example. These files are to be displayed as links to the user and the user can click the link to open the file. The attachment files are stored in the /assets directory in the following manner, alongside the standard assets:

/assets
  /images
  /javascripts
  /stylesheets
  /attachments
    /events
      /11
        poster.jpg
        event-details.pdf

Now as I understand it, when I run the precompile method, Sprockets generates gzipped/MD5'ed versions of the files to be served...how do I deal with these attachment files? If I run the precompile method, everything gets gzipped...but when I add/remove attachments further down the road through the web interface, some will be gzipped and others won't. What's the best way to deal with this?

¿Fue útil?

Solución

I gave up trying to figure out a way around it and just set all the attachments as well as paperclip attachments to be physically put in the /public directory. From my vantage point, this removes the benefit of compressed assets, but whatever.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top