具備範本 Digest
的 Action Controller Etag
當我們的檢視變更時,它們應該泡進 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
包含的模組