# Ruby gem , require and version problem

**URL:** <https://www.ruby-forum.com/t/ruby-gem-require-and-version-problem/179495>\
**Category:** Ruby\
**Created:** [November 26, 2009, 9:59am UTC](https://www.ruby-forum.com/t/ruby-gem-require-and-version-problem/179495 "2009-11-26T09:59:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lasastard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/58956e/32.png) [@lasastard](https://www.ruby-forum.com/u/lasastard)\
**Post date:** [November 26, 2009, 9:59am UTC](https://www.ruby-forum.com/t/ruby-gem-require-and-version-problem/179495/1 "2009-11-26T09:59:33Z")

</div>

Hi,

I am trying to specify the version a gem, which is installed in two  
versions under slightly different names as a result of forked projects  
which we now intend to merge back.

Looks like this in ‘gem list’  
ruby-foo-bar (0.9.2)  
foo-bar (0.9)

Both are supposedly required with:  
require ‘bar’

Now, I need to specifiy which of the two to use for my script - and I  
started with

require ‘rubygems’  
gem ‘bar’, ‘0.9.2’

Throws an error  
/usr/lib/ruby/1.8/rubygems.rb:827:in `report\_activate\_error’: Could not  
find RubyGem bar (= 0.9.2) (Gem::LoadError)

Ok, so then I tried specifiying the names as they appear in the ‘gem  
list’

require ‘rubygems’  
gem ‘ruby-foo-bar’, ‘0.9.2’

That doesn’t throw an error, but the game is apparently not loaded as  
the modules and classes are not recognized subsequently.

System is a fairly fresh install of Ubuntu 9.19, 64 bit and ruby 1.8.7,  
rubygems version is 1.3.5

Any advice would be appreciated.

---

<div class="post-metadata">

**Author:** ![lasastard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/58956e/32.png) [@lasastard](https://www.ruby-forum.com/u/lasastard)\
**Post date:** [November 26, 2009, 11:07am UTC](https://www.ruby-forum.com/t/ruby-gem-require-and-version-problem/179495/2 "2009-11-26T11:07:24Z")

</div>

On Nov 26, 2009, at 00:59 , Marc H. wrote:

> require ‘rubygems’  
> gem ‘ruby-foo-bar’, ‘0.9.2’
> 
> That doesn’t throw an error, but the game is apparently not loaded as  
> the modules and classes are not recognized subsequently.

gem doesn’t load any files, it just activates the right gem.

require ‘rubygems’  
gem ‘ruby-foo-bar’, ‘0.9.2’  
require ‘bar’
