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().