method

must_understand

rails latest stable - Class: ActionController::ConditionalGet

Method not available on this version

This method is only available on newer versions. The first available version (v8.1.1) is shown here.

must_understand()
public

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