开发者

Uninitialized Constant in Rails 3.0.1 using the RedCloth 4.2.2 gem

I'm having an issue with using RedCloth in my local application. I keep getting the following error:

uninitialized constant ActionView::CompiledTemplates::RedCloth

This happens because I have the following code:

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

What I tried to do is put this in the environment.rb file:

require "RedCloth开发者_如何学JAVA"

However, when I do this, I get a huge error with my Phusion Passenger + Nginx configuration, which I've detailed in the following forum: http://railsforum.com/viewtopic.php?id=42560

Any help would be great. Thanks!


Make sure your Gemfile has a gem 'RedCloth' in it. Regardless of which gems are actually installed in your system, Rails will only use the gems listed in your Gemfile. You do not need the require "RedCloth" statement either.


I had exactly the same error and gem 'RedCloth' line was present in Gemfile. What helped was adding require statement in the beginning of controller file

require 'redcloth'

class StaticController < ApplicationController
...
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜