【问题标题】:How do I render RedCloth html in a view in Rails3?如何在 Rails3 的视图中呈现 RedCloth html?
【发布时间】:2011-04-21 22:51:56
【问题描述】:

在 rails 2 中,我使用 来显示由 RedCloth 生成的 HTML,但是在 Rails 3 中我该如何做呢?

<%= raw RedCloth.new(@review).to_html %>

【问题讨论】:

  • 这在 Rails 3 中应该可以正常工作。你的输出是什么 - 转义的 HTML 而不是原始的?

标签: html ruby-on-rails redcloth


【解决方案1】:

使用&lt;%= raw %&gt;

参考:raw vs. html_safe vs. h to unescape html

【讨论】:

  • 嗨,它仍然不起作用...我更新了我的以显示我在做什么...?
猜你喜欢
  • 1970-01-01
  • 2012-02-10
  • 2011-06-13
  • 2013-01-05
  • 1970-01-01
  • 2012-04-19
  • 2013-05-13
  • 1970-01-01
  • 2018-04-25
相关资源
最近更新 更多