RMagick not working


#1

Hello,

On Windows XP, I got a ruby program using RMagick and working perfectly.
I put this at the begining of my code:

require 'rubygems'
require 'RMagick'
include 'Magick'

Now, when I use the exact same code within Rails, I can’t have RMagick
working… It seems it’s not initalizing. The include ‘Magick’ returns
“undefined method `include’” Without the include, I got a “dynamic
constant assignment” when I use an Image or ImageList.

I tried also to remove require’rubygems’ which I think should not be
necessary in Rails.

I know there’s been tons of post regarding RMagick installation before,
but what puzzles me is it seems to be correctly installed… For
instance, it does appear when doing a gem list…

Any idea?


#2

In my app, I simply have require ‘RMagick’

I create new objects like so: Magick::Image.new

I think preceding Image.new is necessary because the class that I am
calling from is named “Image” anyway? I’m not sure. Anyway, that works
for me.


#3

I’m not sure why it’d be giving you the “undefined method ‘include’” but
the
proper include is:

include Magick

without the quotes. It’s not including a file but in fact telling Rails
to
mixin the methods of the module Magick [in the RMagick library]. I’d
recommend mixing these methods in only in whatever specific class you
plan
on implementing RMagick in.

Also, I tried out the quotes around Magick in the include and got a
different error than the one you’re talking about. I got “wrong argument
type String (expected Module) (TypeError)”, which makes sense because of
the
reason I said above.

Hope all that helped.

RSL


#4

Oops, actually, I put

require ‘RMagick’
include Magick

(without the quotes) in my code, already…