Forum: Ruby on Rails How to inject code before plugins load

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Adam B. (Guest)
on 2006-12-24 02:17
I'm having problem with the RMagick requires -- my dev and prod systems
each only work with a different require line (require 'rmagick' on OSX
dev; require 'RMagick' on FC5 prod). After many many hours wasted trying
to figure out WHY they are acting differently, I'm cutting my losses and
going with a hack, like this:

  puts "RMagick was loaded properly on startup." if Magick
rescue NameError
  require 'RMagick'
  puts "RMagick loaded after startup with require 'RMagick'."

This works. However, because one of my plugins (validates_captcha) needs
RMagick, I can't put that code in environment.rb, which is run *after*
the plugins are loaded. Is there a way to inject this block *before* the
plugins are loaded?


Adam B. (Guest)
on 2006-12-24 02:22
> Is there a way to inject this block *before* the
> plugins are loaded?

Yes...just put the code above the existing require line in
environment.rb. Duh.

Doesn't solve my problem, though, since the plugin is hard coded to look
for the RMagick lib named in a way that breaks FC5. Time to edit the
plugin. :(

This topic is locked and can not be replied to.