Skip to content

Instantly share code, notes, and snippets.

@justincaldwell
Created June 7, 2012 17:19
Show Gist options
  • Save justincaldwell/2890156 to your computer and use it in GitHub Desktop.
Save justincaldwell/2890156 to your computer and use it in GitHub Desktop.
def yield_with_default(name, content = nil, &block)
if content_for?(name)
content_for(name)
else
block_given? ? capture(&block) : content
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment