Using RedCloth 3.0.3. Rails when RedCloth 3.0.4. exists

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
→ tools, scripts, tricks from our code lab: http://source.mihelac.org

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

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

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
→ tools, scripts, tricks from our code lab: http://source.mihelac.org


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

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:inactive_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