Reputation: 4425
there are another ways to create helpers instead of using @template.content_tag
and @template.concat
commands?
These look too verbose.
Actually I need to rewrite some helpers like text_field, radio_button, submit, etc..
Upvotes: 3
Views: 153
Reputation: 3789
You want to generate HTML from your helpers, I assume?
You can simply generate strings using any method you want. If you call html_safe
that will prevent the special characters from being escaped.
def header_helper
'<div class="header">This is a test</div>'.html_safe
end
And in the template
<%= header_helper %>
<p>This is the content of the section</p>
Upvotes: 1