-
-
Save PragmaticEd/68f82601d0a893822742d2c6cee06de0 to your computer and use it in GitHub Desktop.
nested content in rails view helpers
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
# because i can never remember exactly how and when to use concat | |
# when building content in helpers | |
def nested_content | |
content_tag 'div' do | |
concat(content_tag 'span', 'span block') | |
concat(tag 'br') | |
concat(link_to 'root link', root_path) | |
concat(tag 'br') | |
concat(link_to('#') do | |
concat(content_tag 'h2', 'Head \'em off') | |
concat(tag 'br') | |
content_tag 'div', (content_tag 'span',(concat 'dudue')) | |
end) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment