Skip to content

Instantly share code, notes, and snippets.

@christos
Created December 30, 2010 12:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christos/759737 to your computer and use it in GitHub Desktop.
Save christos/759737 to your computer and use it in GitHub Desktop.
Surround cached fragments with HTML comments (Rails 2.3 initalizer)
module ActionController
module Caching
module Fragments
def read_fragment_with_comment(name, options)
fragment = read_fragment_without_comment(name, options)
fragment && "\n<!-- cache-hit: #{name} -->\n#{fragment}\n<!-- /cache-hit: #{name} -->\n" || nil
end
alias_method_chain :read_fragment, :comment
end
end
end
@pantulis
Copy link

pantulis commented Jan 5, 2011

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment