Cannot seem to include my own module & classes into Rails ap

Hi – I’ve got a class called SF::SOAP that gets defined at
/lib/wsdl/sandbox/defaultDriver.rb
It is defined like:

module SF
class SOAP
# …
end
end

How do I include this in my Rails app so that I can (for instance) call
SF::SOAP.new without getting an unintitialised constant (for SF) error?
I’ve tried direct requires, adding to the config.load_paths in the
environment files, adding to the $: array, all to no avail.
I did something similar years ago, but I’m damn’ed if I can remember
how, so any help would be very gratefully received.
Cheers,
Doug.

Doug L. wrote:

Hi – I’ve got a class called SF::SOAP that gets defined at
/lib/wsdl/sandbox/defaultDriver.rb
It is defined like:

module SF
class SOAP
# …
end
end

How do I include this in my Rails app so that I can (for instance) call
SF::SOAP.new without getting an unintitialised constant (for SF) error?
I’ve tried direct requires, adding to the config.load_paths in the
environment files, adding to the $: array, all to no avail.
I did something similar years ago, but I’m damn’ed if I can remember
how, so any help would be very gratefully received.

Rails’ dependency loading mechanism will automatically pick up SF::Soap
if it is in the following location: /lib/sf/soap.rb

Best,
Michael G.

Cheers – I was being a total spoon.
All I needed to do was to require it normally – thought I’d tried that,
but must have prepended it with a slash out of habit the first time, or
something.
Thanks,
Doug.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs