diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-25 23:24:36 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-11-25 23:24:36 +0000 |
commit | 5ae821a7fe97c18101908a945de2639c8a48b7a8 (patch) | |
tree | c405f16504db7a78fea63a24c09b638632262a99 /actionpack | |
parent | 18c663eb126c9adc11852dbbc1a1fa2f9e05aa28 (diff) | |
download | rails-5ae821a7fe97c18101908a945de2639c8a48b7a8.tar.gz rails-5ae821a7fe97c18101908a945de2639c8a48b7a8.tar.bz2 rails-5ae821a7fe97c18101908a945de2639c8a48b7a8.zip |
Add documentation about asset timestamps (just for koz)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8209 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 47bbe2f995..441f0dea39 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -38,6 +38,27 @@ module ActionView # Note: This is purely a browser performance optimization and is not meant # for server load balancing. See http://www.die.net/musings/page_load_time/ # for background. + # + # === Using asset timestamps + # + # By default, Rails will prepend all asset paths with that asset's timestamp. This allows you to set a cache-expiration date for the + # asset far into the future, but still be able to instantly invalidate it by simply updating the file (and hence updating the timestamp, + # which then updates the URL as the timestamp is part of that, which in turn busts the cache). + # + # It's the responsibility of the web server you use to set the far-future expiration date on cache assets that you need to take + # advantage of this feature. Here's an example for Apache: + # + # # Asset Expiration + # ExpiresActive On + # <FilesMatch "\.(ico|gif|jpe?g|png|js|css)$"> + # ExpiresDefault "access plus 1 year" + # </FilesMatch> + # + # Also note that in order for this to work, all your application servers must return the same timestamps. This means that they must + # have their clocks synchronized. If one of them drift out of synch, you'll see different timestamps at random and the cache won't + # work. Which means that the browser will request the same assets over and over again even thought they didn't change. You can use + # something like Live HTTP Headers for Firefox to verify that the cache is indeed working (and that the assets are not being + # requested over and over). module AssetTagHelper ASSETS_DIR = defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/public" : "public" JAVASCRIPTS_DIR = "#{ASSETS_DIR}/javascripts" |