Rails' javascript_include_tag :cache => true is evil, and doesn't scale
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
public/javascripts
test
MIT-LICENSE
README.md
Rakefile
init.rb
install.rb
uninstall.rb

README.md

Disable Asset Caching

This is a Rails plugin to disable asset caching for the javascript_include_tag and stylesheet_link_tag Rails helpers. The issue with those is they just don't scale across multiple servers.

And this is why, in glorious ASCII ART:

Browser                   Router            Server 1             Server 2
   |                        |                  |                     |
   GET /index.html ---------|------------------>                     |
                                                } generates all.js   |
   <--------------------------------------------                     |
   |                        |                  |                     |
   |                        |                  |                     |
   GET /javascripts/all.js -|------------------|--------------------->
                                                                      } 404!
   <------------------------------------------------------------------
   |                        |                  |                     |

To sum up: a request for a cached/collapsed asset might end up in a server that didn't generate it yet.

Copyright (c) 2010 Pedro Belo and Terence Lee, released under the MIT license