3

我在本地应用程序中使用 RedCloth 时遇到问题。我不断收到以下错误:

uninitialized constant ActionView::CompiledTemplates::RedCloth

发生这种情况是因为我有以下代码:

<%= RedCloth.new("Some text").to_html %>

我试图做的是把它放在 environment.rb 文件中:

require "RedCloth"

但是,当我这样做时,我的 Phusion Passenger + Nginx 配置出现了巨大错误,我在以下论坛中对此进行了详细说明:http ://railsforum.com/viewtopic.php?id=42560

任何帮助都会很棒。谢谢!

4

2 回答 2

4

确保您的 Gemfile 中有一个gem 'RedCloth'。无论系统中实际安装了哪些 gem,Rails 都只会使用 Gemfile 中列出的 gem。您也不需要该require "RedCloth"声明。

于 2011-01-19T18:10:34.530 回答
3

我遇到了完全相同的错误,并且 Gemfile 中存在 gem 'RedCloth' 行。有什么帮助是在控制器文件的开头添加 require 语句

require 'redcloth'

class StaticController < ApplicationController
...
于 2011-02-17T13:23:33.520 回答