Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## app/controllers/application.rb class ApplicationController < ActionController::Base # ... def with_etag_cache(*etag_params) response.etag = etag_params if request.fresh?(response) head :not_modified else yield end end end ## app/controllers/article.rb class Article < ApplicationController def show with_etag_cache(:article, params[:id]) do # ... fetch and render; will be skipped if E-Tag matches end end end
This paste will be private.
From the Design Piracy series on my blog: