Created
November 5, 2013 21:50
-
-
Save adamzaninovich/7326983 to your computer and use it in GitHub Desktop.
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 ImmutableContentFor | |
def immutable_content_for label, &block | |
content_for label, &block unless content_for? label | |
end | |
def cached_immutable_content_for key, label, &block | |
Rails.cache.write key, block.call unless content_for? label | |
immutable_content_for label, &block | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment