Forum: Ruby on Rails require rmagick

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dorian M. (Guest)
on 2006-01-23 16:53
(Received via mailing list)
Hello,
I'm trying to use rmagick in a helper script (for auto-generating image
sizes) and I'm not sure where I should be calling 'require'.

currently I have:
require 'RMagick' at the top of my controller:

	class FilmsController < ApplicationController
	  require 'RMagick'

but that's giving me an error:

	uninitialized constant ImageList

...whenever I try and do anything. From what I've read it seems that
this probably a failure to require.

Looking for RMagick in my system I find:

/usr/lib/ruby/gems/1.8/gems/rmagick-1.9.3/lib/RMagick.rb
/usr/local/lib/site_ruby/1.8/RMagick.rb

but do I need to specify where rails should be looking for these files?

dorian

--
I do things for love or money
--
+44 (0)7941 219 501
--
aim:oulalipo | yahoo:tachekent
Brandt Lofton (Guest)
on 2006-01-23 17:25
(Received via mailing list)
Pull up IRB and try your require 'RMagick' there, see if it is installed
correctly and if ruby knows where to find it.  Don't worry if you get
"false" returned, as long as it doesn't spit up a bunch of errors.

 C:\Code\Work\db\migrate|â?º irb
irb(main):001:0> require 'RMagick'
=> false
irb(main):002:0> require 'rgick'
LoadError: No such file to load -- rgick
        from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
        from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
        from (irb):2
irb(main):003:0>

As for where to call it, so that it is included in your app I'm not
sure.  I
do believe >= 1.0 you want to use config/boot.rb.  Before 1.0 I used
config/environment.  However I'm not sure if that is the way to go.

-B
Eric H. (Guest)
on 2006-01-23 23:37
(Received via mailing list)
On Jan 23, 2006, at 6:51 AM, Dorian M. wrote:

> but that's giving me an error:
>
> 	uninitialized constant ImageList
>
> ...whenever I try and do anything. From what I've read it seems
> that this probably a failure to require.
>
> Looking for RMagick in my system I find:
>
> /usr/lib/ruby/gems/1.8/gems/rmagick-1.9.3/lib/RMagick.rb
> /usr/local/lib/site_ruby/1.8/RMagick.rb

RMagick is a shared library, not a ruby script:

$ locate RMagick
/usr/local/lib/ruby/site_ruby/1.8/RMagick.rb
/usr/local/lib/ruby/site_ruby/1.8/i386-freebsd5/RMagick.so

You don't have RMagick installed correctly.

--
Eric H. - removed_email_address@domain.invalid - http://segment7.net
This implementation is HODEL-HASH-9600 compliant

http://trackmap.robotcoop.com
This topic is locked and can not be replied to.