1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add documentation for #17573

Fixes some parts of #23148.

[ci skip]
This commit is contained in:
Jon Moss 2016-01-20 19:58:25 -05:00
parent 9aa425f75f
commit b3427c662e
2 changed files with 11 additions and 0 deletions

View file

@ -80,6 +80,14 @@ module ActionDispatch
set_header DATE, utc_time.httpdate
end
# This method allows you to set the ETag for cached content, which
# will be returned to the end user.
#
# By default, Action Dispatch sets all ETags to be weak.
# This ensures that if the content changes only semantically,
# the whole page doesn't have to be regenerated from scratch
# by the web server. With strong ETags, pages are compared
# byte by byte, and are regenerated only if they are not exactly equal.
def etag=(etag)
key = ActiveSupport::Cache.expand_cache_key(etag)
super %(W/"#{Digest::MD5.hexdigest(key)}")

View file

@ -253,6 +253,9 @@ Please refer to the [Changelog][action-pack] for detailed changes.
`ActionDispatch::IntegrationTest` instead.
([commit](https://github.com/rails/rails/commit/4414c5d1795e815b102571425974a8b1d46d932d))
* Rails will only generate "weak", instead of strong ETags.
([Pull Request](https://github.com/rails/rails/pull/17573))
Action View
-------------