Created
May 10, 2011 14:10
-
-
Save farski/964536 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
# In erb view | |
<% title('Title text') # as helper %> | |
<%= content_for :title %> | |
<% content_for(:subtitle) { 'Subtitle text' } %> | |
<%= content_for :subtitle %> | |
<% content_for(:copy) { 'Copy text' } %> | |
<%= yield :copy %> | |
# Result | |
Title text | |
Subtitle text | |
Copy text | |
# In haml view | |
- title('Title text') | |
= content_for(:title) | |
- content_for(:subtitle) { 'Subtitle text' } | |
= content_for(:subtitle) | |
- content_for(:copy) { 'Subtitle text' } | |
= content_for(:copy) | |
# Result | |
Title text | |
# content_for setting is not working outside of helpers... | |
# content_for?(:subtitle) returns false, so there's something preventing this stuff from being set. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment