Rails Asset Caching Breaks First few page loads

Posted by Brian Armstrong on Stack Overflow See other posts from Stack Overflow or by Brian Armstrong
Published on 2010-05-04T23:05:56Z Indexed on 2010/05/10 21:34 UTC
Read the original article Hit count: 296

Filed under:
|
|

We're using Rails asset caching for JS and CSS like this:

<%= javascript_include_tag :defaults, 'autocomplete', 'searchbox', 'jqmodal', :cache => set_asset_cache(:admins) %>

In our deploy we call rake tmp:assets:clear each time. The problem is that the first few page loads after a deploy come up with no css on the page. I guess until the cached all.js and all.css have been regenerated.

We deploy many times per day and this is scary for any users who happen to come across a busted page.

Have people found any way to make this smoother so the new cached assets are guaranteed to be there on the first new page load?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about cache