Created
March 9, 2009 21:18
-
-
Save abloom/76484 to your computer and use it in GitHub Desktop.
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_block(name, &block) | |
override = yield(name) | |
return override unless override.blank? | |
return capture(block) | |
end | |
end |
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
<html> | |
<head> | |
<title> | |
<% content_block(:title) do %> | |
Default Title | |
<% end %> | |
</title> | |
</head> | |
<body> | |
<%= yield %> | |
</body> | |
</html> |
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
<% content_for(:title) do %> | |
Custom Title | |
<% end %> | |
Regular body content here will end up in the lone "yield" in the template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment