Created
December 30, 2010 12:32
-
-
Save christos/759737 to your computer and use it in GitHub Desktop.
Surround cached fragments with HTML comments (Rails 2.3 initalizer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool!