【问题标题】:Using Redcarpet with rails 4将 Redcarpet 与 rails 4 一起使用
【发布时间】:2015-04-19 06:05:02
【问题描述】:

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

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

我的 rails 应用似乎不知道有 Redcarpet。我给了NoMethodError

undefined method `new' for Redcarpet:Module

我该如何解决这个问题?

【问题讨论】:

    标签: ruby-on-rails ruby ruby-on-rails-4 markdown redcarpet


    【解决方案1】:

    请尝试以下方法:

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

    您可能想查看definition of that method

    【讨论】:

    • 像魅力一样工作。谢谢!
    • 谢谢 真的很有帮助。
    猜你喜欢
    • 2015-11-11
    • 2013-09-19
    • 1970-01-01
    • 2015-08-19
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 2020-01-28
    • 2013-09-17
    相关资源
    最近更新 更多