# Uninitialized constant w/ ActiveResource

**URL:** <https://www.ruby-forum.com/t/uninitialized-constant-w-activeresource/67204>\
**Category:** Rails\
**Created:** [September 1, 2006, 11:43am UTC](https://www.ruby-forum.com/t/uninitialized-constant-w-activeresource/67204 "2006-09-01T11:43:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HHHHHH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/50afbb/32.png) [@HHHHHH](https://www.ruby-forum.com/u/HHHHHH)\
**Post date:** [September 1, 2006, 11:43am UTC](https://www.ruby-forum.com/t/uninitialized-constant-w-activeresource/67204/1 "2006-09-01T11:43:39Z")

</div>

Howdy,

I had an application perfect for ActiveResource, which I do realize is  
not  
finished.

Anyway, I froze my app to edge and then defined a class:

class Address \< ActiveResource::Base  
self.site =  
“[http://ws.geonames.org/findNearestAddress?lat=:lat&lng=:long](http://ws.geonames.org/findNearestAddress?lat=:lat&lng=:long)”  
End

I tried to use it from the console but I get the trace below.

It appears it can’t ‘see’ ActiveResource.

What am I doing wrong?

Thanks,  
Hunter

> > @location.address  
> > NameError: uninitialized constant ActiveResource  
> > from  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesu  
> > pport/lib/active\_support/dependencies.rb:237:in `load_missing_constant' from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesu pport/lib/active_support/dependencies.rb:315:in `const\_missing’  
> > from  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesu  
> > pport/lib/active\_support/dependencies.rb:322:in `const_missing' from ./script/../config/../config/../app/models/address.rb:1 from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesu pport/lib/active_support/dependencies.rb:343:in `load’  
> > from  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesu  
> > pport/lib/active\_support/dependencies.rb:183:in `load_file' from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesu pport/lib/active_support/dependencies.rb:85:in `require\_or\_load’  
> > from  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesu  
> > pport/lib/active\_support/dependencies.rb:219:in `load_missing_constant' from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesu pport/lib/active_support/dependencies.rb:315:in `const\_missing’  
> > from  
> > ./script/…/config/…/config/…/vendor/rails/activerecord/lib/…/…/activesu  
> > pport/lib/active\_support/dependencies.rb:322:in `const_missing' from ./script/../config/../config/../vendor/rails/activerecord/lib/../../activesu pport/lib/active_support/dependencies.rb:328:in `const\_missing’  
> > from ./script/…/config/…/config/…/app/models/location.rb:8:in  
> > `address’  
> > from (irb):2

---

<div class="post-metadata">

**Author:** ![HHHHHH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/50afbb/32.png) [@HHHHHH](https://www.ruby-forum.com/u/HHHHHH)\
**Post date:** [September 1, 2006, 12:09pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-w-activeresource/67204/2 "2006-09-01T12:09:46Z")

</div>

On 9/1/06, HH [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> End
> 
> I tried to use it from the console but I get the trace below.
> 
> It appears it can’t ‘see’ ActiveResource.
> 
> What am I doing wrong?

active resource isn’t a part of rails right now, so you’ll have to  
specifically require it in environment.rb.

–  
Rick O.  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![HHHHHH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/50afbb/32.png) [@HHHHHH](https://www.ruby-forum.com/u/HHHHHH)\
**Post date:** [September 1, 2006, 7:19pm UTC](https://www.ruby-forum.com/t/uninitialized-constant-w-activeresource/67204/3 "2006-09-01T19:19:09Z")

</div>

Thanks.

I tried that by doing this:

config.load\_paths += %W( #{RAILS\_ROOT}/vendor/rails/activeresource/lib )

I am still getting the same error after restarting the server.

Is there another way to require it? I got this method from Gooooogle.
