Topic: Unable to Use RedCloth in Rails 3.0.1

Hey Everyone,

Before anything, I did a search of this problem and am hardly able to find anything related to my issue or a solution.

The Problem: When starting my app using Phusion Passenger with Nginx, I get the following error:

    no such file to load -- RedCloth

Solutions Tried:

Downgrading from RedCloth 4.2.3 to RedCloth 4.2.2
Downgrading from Rails 3.0.3 to Rails 3.0.1 (3.0.1 was stable environment and I had updated to 3.0.3 just in case that was a solution)
Checked my Nginx configuration to make sure it was using the correct rvm gemset
Made sure the gem was installed in the right rvm gemset
Required RedCloth in my environment.rb
Restarting Nginx


My Development Environment:

ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0]
Rails 3.0.1
rvm 1.2.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

Gem List:

abstract (1.0.0)
actionmailer (3.0.1)
actionpack (3.0.1)
activemodel (3.0.1)
activerecord (3.0.1)
activeresource (3.0.1)
activesupport (3.0.1)
arel (1.0.1)
builder (2.1.2)
bundler (1.0.7)
daemon_controller (0.2.5)
erubis (2.6.6)
fastthread (1.0.7)
file-tail (1.0.5)
gravatar_image_tag (1.0.0)
i18n (0.4.2)
jquery-rails (0.2.4)
mail (2.2.14)
mime-types (1.16)
mysql2 (0.2.6)
passenger (3.0.0)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.7)
rails (3.0.1)
railties (3.0.1)
rake (0.8.7)
RedCloth (4.2.3)
remotipart (0.1.1)
spruz (0.2.2)
thor (0.14.6)
treetop (1.4.9)
tzinfo (0.3.24)
will_paginate (3.0.pre2)

The funny thing is that I had written a post on this before (http://alvincrespo.com/textile-redcloth-and-rails3/) and now for some reason this doesn't work. I've also tried following http://craiccomputing.blogspot.com/2009 … ls-22.html but that doesn't work either.

(insert extremely sad face here)

Re: Unable to Use RedCloth in Rails 3.0.1

Some additonal information:

which ruby
/Users/alvincrespo/.rvm/rubies/ruby-1.8.7-p330/bin/ruby

which rails
/Users/alvincrespo/.rvm/gems/ruby-1.8.7-p330@lajobr/bin/rails

gem which RedCloth
/Users/alvincrespo/.rvm/gems/ruby-1.8.7-p330@lajobr/gems/RedCloth-4.2.2/lib/RedCloth.rb


Passenger Configuration:

passenger_root /Users/alvincrespo/.rvm/gems/ruby-1.8.7-p330@lajobr/gems/passenger-3.0.0;
passenger_ruby /Users/alvincrespo/.rvm/wrappers/ruby-1.8.7-p330@lajobr/ruby;

Re: Unable to Use RedCloth in Rails 3.0.1

I had the same problem. You have to require your gem in your helper

#helper
def textillize(str)
  require 'RedCloth'
  RedCloth.new(str).to_html
end

I'm not sure about the string passed to "require"

Re: Unable to Use RedCloth in Rails 3.0.1

Just had the same problem, I fixed it by changing my Gemfile to look like this

gem 'RedCloth', :require => 'redcloth'

I imagine this problem occurs for a lot of people in dev and not production because OS X has a case-insensitive filesystem while linux does not.