instance method
must_understand
Ruby on Rails edge
Since v8.1.3.1Available in: v8.1.3.1 edge
Signature
must_understand()
Adds the must-understand directive to the Cache-Control header, which indicates that a cache MUST understand the semantics of the response status code that has been received, or discard the response.
This is particularly useful when returning responses with new or uncommon status codes that might not be properly interpreted by older caches.
Example
def show
@article = Article.find(params[:id])
if @article.early_access?
must_understand
render status: 203 # Non-Authoritative Information
else
fresh_when @article
end
end
Source
# File actionpack/lib/action_controller/metal/conditional_get.rb, line 357
def must_understand
response.cache_control[:must_understand] = true
response.cache_control[:no_store] = true
end
Defined in actionpack/lib/action_controller/metal/conditional_get.rb line 357
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionController::ConditionalGet