ruby-on-railsruby-on-rails-3rubygemsinitializationredcloth

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"

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!


Solution

  • 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.