# Problems loading gems

**URL:** <https://www.ruby-forum.com/t/problems-loading-gems/144768>\
**Category:** Rails\
**Created:** [August 1, 2008, 9:41pm UTC](https://www.ruby-forum.com/t/problems-loading-gems/144768 "2008-08-01T21:41:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxmotor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cc9497/32.png) [@maxmotor](https://www.ruby-forum.com/u/maxmotor)\
**Post date:** [August 1, 2008, 9:41pm UTC](https://www.ruby-forum.com/t/problems-loading-gems/144768/1 "2008-08-01T21:41:31Z")

</div>

I have some code in a controller that requires the GeoX gem. Let’s say I  
have the following code:

…  
require ‘rubygems’  
require ‘geox’  
geocoder = GeoX::Geocoder.new(:geoengine =\> GeoX::Google)  
…

If I run this in the rails console for the site it works perfectly, but  
the same code in my controller or a rake task fails with the following  
message:

no such file to load – geox

What am I doing wrong over here? I’m at a complete loss. Thanks in  
advance for your help.

- m a x

---

<div class="post-metadata">

**Author:** ![maxmotor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cc9497/32.png) [@maxmotor](https://www.ruby-forum.com/u/maxmotor)\
**Post date:** [August 2, 2008, 1:24am UTC](https://www.ruby-forum.com/t/problems-loading-gems/144768/2 "2008-08-02T01:24:50Z")

</div>

On 1 Aug 2008, at 20:41, Max Stahl wrote:

> If I run this in the rails console for the site it works perfectly,  
> but  
> the same code in my controller or a rake task fails with the following  
> message:
> 
> no such file to load – geox
> 
> What am I doing wrong over here? I’m at a complete loss. Thanks in  
> advance for your help.

To load the gem you should use  
gem ‘geox’  
(and then possibly use require to load files from inside the gem)  
rails does fiddle with requite and so on which may explain some of the  
differences

Fred

---

<div class="post-metadata">

**Author:** ![maxmotor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/cc9497/32.png) [@maxmotor](https://www.ruby-forum.com/u/maxmotor)\
**Post date:** [August 2, 2008, 2:05am UTC](https://www.ruby-forum.com/t/problems-loading-gems/144768/3 "2008-08-02T02:05:21Z")

</div>

yeah now it says this:

Could not find RubyGem geox (\>= 0.0.0)

Geox is installed as a plugin, not a gem, but I had previously tried  
using the google-geocode gem and it failed the same way.

Frederick C. wrote:

> On 1 Aug 2008, at 20:41, Max Stahl wrote:
> 
> > If I run this in the rails console for the site it works perfectly,  
> > but  
> > the same code in my controller or a rake task fails with the following  
> > message:
> > 
> > no such file to load – geox
> > 
> > What am I doing wrong over here? I’m at a complete loss. Thanks in  
> > advance for your help.
> 
> To load the gem you should use  
> gem ‘geox’  
> (and then possibly use require to load files from inside the gem)  
> rails does fiddle with requite and so on which may explain some of the  
> differences
> 
> Fred
