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

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.
B15edcdfdbecf5723067df3e24e4f6f0?d=identicon&s=25 Adam Block (adamblock)
on 2006-12-24 01: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:

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

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?

Thanks!

/afb
B15edcdfdbecf5723067df3e24e4f6f0?d=identicon&s=25 Adam Block (adamblock)
on 2006-12-24 01: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. :(

/afb
This topic is locked and can not be replied to.