Action Controller Etag With Template Digest¶ ↑
当我们的视图发生更改时,它们应该反映到 HTTP 缓存的新鲜度并使浏览器缓存失效。因此,当前操作的模板摘要会自动包含在 ETag 中。
对于使用 Action View 的应用程序,默认启用。通过设置禁用
config.action_controller.etag_with_template_digest = false
通过将 :template 传递给 fresh_when 和 stale? 调用来覆盖要摘要的模板。例如
# We're going to render widgets/show, not posts/show fresh_when @post, template: 'widgets/show' # We're not going to render a template, so omit it from the ETag. fresh_when @post, template: false
包含的模块