# Using RedCloth 3.0.3. Rails when RedCloth 3.0.4. exists

**URL:** <https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332>\
**Category:** Rails\
**Created:** [December 14, 2006, 9:43am UTC](https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332 "2006-12-14T09:43:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [December 14, 2006, 9:43am UTC](https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332/1 "2006-12-14T09:43:12Z")

</div>

Hi all,  
I am trying to use RedCloth 3.0.3. on shared host but when I put  
direction to include this version in enviroment.rb:  
require ‘rubygems’  
require\_gem ‘RedCloth’, ‘= 3.0.3’

I receive error: /usr/lib/site\_ruby/1.8/rubygems.rb:149:in `activate’:  
can’t activate RedCloth (= 3.0.3), already activated RedCloth 3.0.4.  
Exception).

When I put this commands in boot.rb instead, it works, but it say that  
boot.rb should not use for configuration… so the question is where  
requiring should occur and if there is better way to do this?  
(nistalling 3.0.4 is not an option)

thanks for answer in advance,  
Bojan

–  
Bojan M.  
Informatika Mihelac, Bojan M. s.p. | [www.informatikamihelac.com](http://www.informatikamihelac.com)  
 → tools, scripts, tricks from our code lab: [http://source.mihelac.org](http://source.mihelac.org)

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [December 14, 2006, 10:29am UTC](https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332/2 "2006-12-14T10:29:16Z")

</div>

Hi, you may need to freeze rails as well as non-rails gems locally  
before upload to your shared host. This simply recreates your local  
configuration onto the remote host and I believe this is the  
recommended way of doing things in this situation.

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [December 14, 2006, 7:52pm UTC](https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332/3 "2006-12-14T19:52:37Z")

</div>

I’ve run across this problem myself and found that [for my setup at  
least]  
requiring “redcloth” in config/environment.rb BEFORE the Rails  
Initializer  
block loads the correct, specified version. Rails loads RedCloth on its  
own  
in the initialization block so unless you do it before then you’re stuck  
with the Rails version. Most of the time it’s not a problem so I  
wouldn’t  
call it a bug really. Just undocumented.

RSL

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [December 14, 2006, 10:51am UTC](https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332/4 "2006-12-14T10:51:21Z")

</div>

Thanks Conrad,  
but what if I have both versions of RedCloth on local machine as well?  
there should be way to specify which RedCloth Rails should use,  
shouldn’t it?

Bojan

Conrad T. wrote:

> > Bojan M.  
> > Informatika Mihelac, Bojan M. s.p. | [www.informatikamihelac.com](http://www.informatikamihelac.com)  
> > → tools, scripts, tricks from our code lab: [http://source.mihelac.org](http://source.mihelac.org)
> 
> >

–  
Bojan M.  
Informatika Mihelac, Bojan M. s.p. | [www.informatikamihelac.com](http://www.informatikamihelac.com)  
 → tools, scripts, tricks from our code lab: [http://source.mihelac.org](http://source.mihelac.org)

---

<div class="post-metadata">

**Author:** ![bmihelac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/5fc32e/32.png) [@bmihelac](https://www.ruby-forum.com/u/bmihelac)\
**Post date:** [January 6, 2007, 1:33pm UTC](https://www.ruby-forum.com/t/using-redcloth-3-0-3-rails-when-redcloth-3-0-4-exists/79332/5 "2007-01-06T13:33:26Z")

</div>

Russell N. wrote:

> I’ve run across this problem myself and found that [for my setup at  
> least]  
> requiring “redcloth” in config/environment.rb BEFORE the Rails  
> Initializer  
> block loads the correct, specified version. Rails loads RedCloth on its  
> own  
> in the initialization block so unless you do it before then you’re stuck  
> with the Rails version. Most of the time it’s not a problem so I  
> wouldn’t  
> call it a bug really. Just undocumented.
> 
> RSL

Hello, I have the exact problem here - but requiring the gem before the  
initialization block doesn’t work here.  
Even if I write  
require\_gem ‘RedCloth’, ‘3.0.3’  
as the first line of environment.rb (even before setting the  
RAILS\_GEM\_VERSION), I get this error:

script/server webrick  
=\> Booting WEBrick…  
/usr/lib/ruby/site\_ruby/1.8/rubygems.rb:196:in `activate': can't activate RedCloth (= 3.0.3), already activated RedCloth-3.0.4] (Gem::Exception) from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:66:in`active\_gem\_with\_options’  
from /usr/lib/ruby/site\_ruby/1.8/rubygems.rb:59:in `require\_gem’  
from ./script/…/config/…/config/environment.rb:1  
…

why?

Johannes Held
