Dan Cruickshank wrote:
I’m hoping a require can fix it but I’m not having any luck. I don’t
understand why I’d need to require something inside of rails that I
don’t in my test.
Do you have the soap4r gem installed? There’s an old and now rather
broken soap4r in the ruby standard library. Perhaps you’re using the gem
in one environment and not the other. Worse, perhaps you have loaded
part of the old soap4r before gems are activated, and another part
At the line before the error in fax_api.rb you could break into debugger
and poke around, or add debugging statements like
Also: take your working test code and run it using
which will first boot up the rails environment, then run the script you
provide. Does it now fail?
What about using script/console instead of irb?
If you can make a standalone test case which is just a couple of lines
that you run from script/runner or script/console, that would be an
ideal way to get the problem resolved quickly.
FaxApi - Throws an “uninitialized constant FaxApi::WSDLDriverFactory”
error when called from the controller
Are you sure that’s the error it gives? Not FaxAPI::SOAP ?
Now, I agree you don’t need to require soap if you have done this in
your fax_api.rb file. But you could try this at the top of fax_api.rb:
and/or declare the soap4r gem dependency in config/environment.rb
And for extra belt-and-braces use ::SOAP instead of SOAP, i.e. change
I wouldn’t worry about the return value from ‘require’, since Rails
mucks around with the internals of require (as well as const_missing
stuff). But if none of the above helps, check what version of rubygems
you have installed. If it’s not the latest, try upgrading it.