Created
January 24, 2012 00:01
-
-
Save nickhoffman/1666614 to your computer and use it in GitHub Desktop.
Nesting text within a content tag.
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
# The HTML that should be generated is: | |
# <h3 class="curated_by">Curated by <span>Bob</span></h3> | |
# Please tell me that there's a better way to do this. | |
def curated_by | |
html = '' | |
html += h.content_tag(:h3, :class => 'curated_by') do | |
h.concat h.t('phrases.Curated_by') | |
h.concat ' ' | |
h.concat h.content_tag(:span, curator_username) | |
end.html_safe | |
html.html_safe | |
end |
@victorbstan I considered that, but writing raw HTML feels so wrong, even in a presenter.
The ideology of perfection is crippling though, isn't it?
Hah yeah, it is.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note, you're not nesting text in a content_tag, but why do you need to nest text necessarily?