Mixing h() helper and plain output in rhtml

Sometimes You need to generate output from .rhtml templates with HTML tags escaped mixed with real HTML tags. You can open and close Ruby code tags ( <%= <%=h ) but there is simpler method. In <%= block call h() helper directly. To work You need show correct name space – and this is ERB::Util::h().

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.