Doug Livesey
2009-Aug-02 20:13 UTC
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. -- Posted via http://www.ruby-forum.com/.
Michael Guterl
2009-Aug-03 02:13 UTC
Re: Cannot seem to include my own module & classes into Rails ap
Doug Livesey 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 Guterl -- Posted via http://www.ruby-forum.com/.
Doug Livesey
2009-Aug-03 07:52 UTC
Re: Cannot seem to include my own module & classes into Rail
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. -- Posted via http://www.ruby-forum.com/.