module ActionController::ConditionalGet::ClassMethods

def etag(&etagger)

end
end
fresh_when etag: @invoice
@invoice = Invoice.find(params[:id])
# Etag will differ even for the same invoice when it's viewed by a different current_user
def show

etag { current_user&.id }
class InvoicesController < ApplicationController

to prevent unauthorized displaying of cached pages.
at the moment, you may want to add the current user id to be part of the ETag
an ETag. For example, if you serve pages tailored depending on who's logged in
Allows you to consider additional controller-wide information when generating
def etag(&etagger)
  self.etaggers += [etagger]
end