Color is not a module

Color is not a module /usr/lib/ruby/gems/1.8/gems/color-1.4.0/lib/color.rb:19

Gems installed in application: pdf-writer 1.1.8 + color 1.4.0 + color-tools 1.3.0 can happen to any pdf-writer version and in any OS (tested on XP/ Ubuntu/Debian/FreeBSD)

I have two models:

require 'pdf/writer' require 'pdf/writer/graphics' require 'pdf/simpletable' class ModelA < ActiveRecord::Base end In this model i generate pdf's.

AND: require 'RMagick' include Magick require 'rvg/rvg' class ModelB < ActiveRecord::Base end And in this model i generate images's.

Problem are raised when i added ModelB rmagick support. I was unable to use pdf generator(ModelA) as well as ModelB.

After some research i found that if i remove requires from ONE OF model, other model is working well ....

Temporary i removed ModelB requirements (generating images from another place). Looking for solution ..

require 'RMagick' include Magick require 'rvg/rvg' class ModelB < ActiveRecord::Base end And in this model i generate images's.

Problem are raised when i added ModelB rmagick support. I was unable to use pdf generator(ModelA) as well as ModelB.

After some research i found that if i remove requires from ONE OF model, other model is working well ....

Does removing include Magick (or moving it inside the ModelB class help) (obviously you may then need to say Magick::Blah rather than Blah for some things) ?

Fred

Yes i've tried it - if i remove Magick requirement then pdf model working, and vice versa. Problem that Magick having its Color class Magick::Color that is override on module Color (color gem)

So current my solution is to generate image elsewhere..

Yes i've tried it - if i remove Magick requirement then pdf model working, and vice versa. Problem that Magick having its Color class Magick::Color that is override on module Color (color gem)

So current my solution is to generate image elsewhere..

Just don't import Magick into the toplevel namespace and you'll be ok.

Fred