nonstic Random snippets of mac and rails goodness

2 December 2008 @ 11pm

Ruby, Rails, Slicehost

Fixing RedCloth (undefined method `textilize') Errors on Shared Hosts


You’ve developed a Rails app utilizing the RedCloth “textilize” method to apply the textile filter to to text field.

eg. <%= textilize @post.body %>

You may have the “RedCloth” gem installed, or unpacked to /vendor.

This app works fine on your local Mac workstation. When you try to run your app in Production mode on the server, you get a undefined methodtextilize’` error.

If you try to require the gem in “environment.rb”, the server throws an error on startup, similar to:

no such file to load -- RedCloth

No attempts to include redcloth, RedCloth, or any other library seem to help.


(Your mileage may vary, but this is what worked for me. I don’t guarantee this works in all situations, but if you come via a desperate Google search, it’s worth a shot.)

Some people report that if you downgrade your RedCloth gem far enough (perhaps as far down as 3.0.3) it will eventually work. However, I want to use at least version 4.x of the RedCloth gem, because it fixes a bunch of bugs found in 3.x.

What finally worked for me was going into “/usr/lib/ruby/gems/1.8/gems/RedCloth-X.XXX/lib/” and creating a symlink thusly:

# modify for whatever version of the RedCloth gem you have installed
# eg. 4.1.0, 4.0.3, etc.
cd /usr/lib/ruby/gems/1.8/gems/RedCloth-4.1.1/lib/
ln -s redcloth.rb RedCloth.rb

Restart mongrel, and voila!


No Comments Yet

There are no comments yet. You could be the first!

Leave a Comment