开发者

content_tag formatting to entities?

When I use content_tag, my t开发者_如何学Pythonags get converted to their HTML entity equivalent. The code I use is

The view renders

Hello This is a <strong>test</strong>

When I'd like it to render

Hello This is a test

The content format of the database is text, which may or may not affect the output, since there are newlines and return carriages within the content.


You should tell Rails the content is safe. Two options:

  • your_content.html_safe

  • <%=raw your_content %>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜