cache logic in js_include_tag and stylesheet_link_tag?

So using the magic :cache argument to combine multiple CSS or JS files
into one cached file, using stylesheet_link_tag or
javascript_include_tag respectively...

I sort of figured that if the arguments to the function changed,
including different files.... the combined cached file would be
re-generated.

This does not seem to be the case.

javascript_include_tag "a", "b", :cache => "my_key"

Stop application. Edit the code to be:

javascript_include_tag "a", "b", "c", :cache => "my_key"

Restart the application. Run it. The combined cached my_key.js file
still only includes "a" and "b", the cached file was not invalidated
when I added "c" to it. I had to go and find the file and rm it myself.

Is this a bug? Or is this expected behavior? Is there something I'm
missing? Under what circumstances is the cached file supposed to be
regenerated? If the last-modified timestamp changes on one of the
included files, will it be regenerated? Will it EVER be re-generated?

Jonathan Rochkind wrote:

Is this a bug? Or is this expected behavior? Is there something I'm
missing? Under what circumstances is the cached file supposed to be
regenerated? If the last-modified timestamp changes on one of the
included files, will it be regenerated? Will it EVER be re-generated?

I see the same behavior, and I basically use the same solution. Probably
not a bad idea to add a step to your Capistrano (or whatever deploy
tool) to delete those files on each deployment.

Robert Walker wrote:

Jonathan Rochkind wrote:

Is this a bug? Or is this expected behavior? Is there something I'm
missing? Under what circumstances is the cached file supposed to be
regenerated? If the last-modified timestamp changes on one of the
included files, will it be regenerated? Will it EVER be re-generated?

I see the same behavior, and I basically use the same solution. Probably
not a bad idea to add a step to your Capistrano (or whatever deploy
tool) to delete those files on each deployment.

Thanks for the response. I'm thinking this is a bug, and I'll try to go
ahead and file it in the tracker, although I lack the Rails fu to fix it
myself.

In the absence of a fix, could also add something to your Rails app
startup routines to delete the files, to work regardless of Capistrano
use or not.

Hi Jonathan

   Read this also.
http://maintainable.com/articles/rails_asset_cache

If any modification happens to js or css as specified, then before next
release you can apply this trick

Sijo