Enhance cache-busting options

I am nudging this now that Rails 3 is out and (hopefully) someone has time to review it

https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5190-patch-enhance-cache-busting-customization

The current Rails cache busting regime (in ActionView::Helpers) gives you three options:

* asset_path + mtime query string (The default) * RAILS_ASSET_ID environment variable used in place of mtime * A proc called on config.action_controller.asset_path

The proc receives the asset_path, and the user can prepend a directory name (for example) for each release so that remote caches refetch the asset:

RELEASE_NUMBER = 12345 config.action_controller.asset_path = proc { |asset_path|   "/release-#{RELEASE_NUMBER}#{asset_path}" }

This patch also passes in the asset_id to the proc (using the internal asset_id caching mechanism), allowing the user to insert the mtime into the filename:

config.action_controller.asset_path = proc { |asset_path, asset_id|   asset_path.clone.insert(-(File.extname(asset_path).length+1),"-#{asset_id}") }

This is the optimal regime for single server deployments (and those where the mtime can be synchronized between servers) because only assets that are actually modified will be refetched by the client browser or intermediate cache. On a site with many static assets and unique browsers this will reduce massive traffic spikes after a deployment.

The alternative is for the user to override ActionView::Helpers.rewrite_asset_path, but they would also have to handle the different Rails environments.

The submitted approach avoids having to to do this by extending the current method of altering the asset_path as a config option.

I have added tests and updated the documentation in the helper module.

regards, Richard