Created
September 17, 2012 05:00
-
-
Save chsh/3735634 to your computer and use it in GitHub Desktop.
Use fragment cache in helper method.
This file contains 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 ApplicationHelper | |
def content_with_cache(key, content) | |
controller.read_fragment(key) || | |
controller.write_fragment(key, content) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"cache" method is available. But it doesn't return content. So, we can't embed using equal operator in view file. ;-)