1

我安装了红地毯。我正在关注如何使用它的 272 Railscast 教程。我有这条线show.html.erb

 <%= Redcarpet.new(@topic.text).to_html %>

我的 Rails 应用程序似乎不知道有 Redcarpet。我给出一个NoMethodError

undefined method `new' for Redcarpet:Module

我该如何解决这个问题?

4

1 回答 1

4

请尝试以下方法:

<%= Markdown.new(@topic.text).to_html %>

您可能想查看该方法的定义

于 2015-04-19T06:42:14.000 回答