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

**URL:** <https://www.ruby-forum.com/t/cannot-seem-to-include-my-own-module-classes-into-rails-ap/173103>\
**Category:** Rails\
**Created:** [August 2, 2009, 10:13pm UTC](https://www.ruby-forum.com/t/cannot-seem-to-include-my-own-module-classes-into-rails-ap/173103 "2009-08-02T22:13:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![biot023](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@biot023](https://www.ruby-forum.com/u/biot023)\
**Post date:** [August 2, 2009, 10:13pm UTC](https://www.ruby-forum.com/t/cannot-seem-to-include-my-own-module-classes-into-rails-ap/173103/1 "2009-08-02T22:13:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![biot023](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@biot023](https://www.ruby-forum.com/u/biot023)\
**Post date:** [August 3, 2009, 4:13am UTC](https://www.ruby-forum.com/t/cannot-seem-to-include-my-own-module-classes-into-rails-ap/173103/2 "2009-08-03T04:13:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![biot023](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@biot023](https://www.ruby-forum.com/u/biot023)\
**Post date:** [August 3, 2009, 9:52am UTC](https://www.ruby-forum.com/t/cannot-seem-to-include-my-own-module-classes-into-rails-ap/173103/3 "2009-08-03T09:52:36Z")

</div>

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.
