#357 ✓resolved

Etag support via stale? method not covered

Reported by Obie | July 13th, 2010 @ 07:25 PM | in The Rails 3 Way


Sets the etag and/or last_modified on the response and checks it against the client request. If the request doesn‘t match the options provided, the request is considered stale and should be generated from scratch. Otherwise, it‘s fresh and we don‘t need to generate anything and a reply of "304 Not Modified" is sent.
:etag :last_modified :public By default the Cache-Control header is private, set this to true if you want your application to be cachable by other devices (proxy caches). Example:

def show
  @article = Article.find(params[:id])
  if stale?(:etag => @article, :last_modified => @article.created_at.utc)

@statistics = @article.really_expensive_call
respond_to do |format|
  # all the supported formats

end end

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

People watching this ticket

Referenced by