Rails won't load gems


I’m working on a Rails application. However, for some reason it won’t load gems.

I created a library to communicate with the eNom API, and am using LibXML to parse the response. It works when I test it by itself, but won’t work when I use it through a model. If I try requiring xml or libxml, it says the file couldn’t be loaded. If I just try using it, since I enabled it in config/environment.rb, it says uninitialized constant.

If I load script/console, I can call LibXML or just XML just fine. However it just won’t work in the application itself.

Gems are installed and working. I defined RUBYOPT in /etc/bashrc to load rubygems. They are working in ruby applications that aren’t using rails. However in rails itself it won’t work.

Version information:

  • ruby 1.8.7
  • gem 1.3.7
  • rails 2.3.5
  • libxml-ruby 1.1.4

Any help is much appreciated.

Oh, this was solved long ago. I’m not patient enough to wait three weeks without finding a way to solve something. :stuck_out_tongue:

I’d post what I did, but I’m not really sure. It was a lot of trial and error, but it just started working.

Thanks though.

Can you post an example of the code you use in a model to require the LibXML? Also the error output would be useful.