diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2016-02-24 14:23:41 -0300 |
---|---|---|
committer | Rafael França <rafaelmfranca@gmail.com> | 2016-02-24 14:23:41 -0300 |
commit | edbab4e4f558b1593d55b65022cfe7f7d34d49cd (patch) | |
tree | d40d3175b78033feaa913a02c507f7a2461d1a41 /guides | |
parent | 42270189b7f35abec590c1251f43bad6ac404977 (diff) | |
parent | a6f8526ee68d1b8a33b5e112dd8ff3d2ace4ad69 (diff) | |
download | rails-edbab4e4f558b1593d55b65022cfe7f7d34d49cd.tar.gz rails-edbab4e4f558b1593d55b65022cfe7f7d34d49cd.tar.bz2 rails-edbab4e4f558b1593d55b65022cfe7f7d34d49cd.zip |
Merge pull request #23860 from zerothabhishek/weak-etag-guide
Changes caching guide to add note on weak etags
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/caching_with_rails.md | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index 3a1a1ccfe6..2df478b5aa 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -521,6 +521,14 @@ class ProductsController < ApplicationController end ``` +### A note on weak ETags + +Etags generated by Rails are weak by default. Weak etags allow symantically equivalent responses to have the same etags, even if their bodies do not match exactly. This is useful when we don't want the page regenerated for minor changes in response body. If you absolutely need to generate a strong etag, it can be assigned to the header directly. + +```ruby + response.add_header "ETag", Digest::MD5.hexdigest(response.body) +``` + References ---------- |