Skip to content

Instantly share code, notes, and snippets.

View gbuesing's full-sized avatar

Geoff Buesing gbuesing

View GitHub Profile

Declared ETags, together with Russian Doll caching, can be used to automatically mix your template and asset versions into the ETags set in your controllers. This avoids the need to blow all browser caches on each deploy and neatly contains the scope of "freshness fallout" when you tweak a view.

To include the template's version in the ETag:

  # Incorporate the cache version for this action into our ETag.
  # This allows template changes to bubble up into HTTP cache
  # freshness and bust browser caches when we make changes.
  etag do
    begin
@gbuesing
gbuesing / ugly couchrest hacks.rb
Created March 20, 2009 22:11 — forked from will/ugly couchrest hacks.rb
Hash hacks so that CouchRest::Document plays nice with Rails routes
# Hacks so that CouchRest::Document, which descends from Hash,
# doesn't appear to Rails routing as a Hash of options
class Hash
def self.===(other)
return false if other.is_a?(CouchRest::Document)
super
end
end