Skip to content

Instantly share code, notes, and snippets.

@adamzaninovich
Created November 5, 2013 21:50
Show Gist options
  • Save adamzaninovich/7326983 to your computer and use it in GitHub Desktop.
Save adamzaninovich/7326983 to your computer and use it in GitHub Desktop.
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