Last active
August 29, 2015 14:14
-
-
Save brianjlandau/c4943667e59a4d6c0a63 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
<% if my_block_content.present? %> | |
<%= my_block_content%> | |
<% else %> | |
<%# default without block %> | |
<% end %> |
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 MyHelper | |
def special_thing(locals, &block) | |
content_for_partial = capture(&block) if block_given? | |
render :partial => 'shared/my_partial', | |
:locals => locals.merge(:my_block_content => content_for_partial) | |
end | |
end |
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
<%= special_thing({:a_local_variable_for_partial => some_object.value}) %> | |
<%# OR with a block %> | |
<%= special_thing({:a_local_variable_for_partial => some_object.value}) do %> | |
<p>Some <em>special</em> markup</p> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment