[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Trying (and failing) to load specific version of gem

Brian Candler

4/11/2008 11:19:00 AM

I wonder if someone can help with a problem which I'm sure is very simple
and obvious, but I'm tearing my hair out.

I have rubygems 1.0.1 installed. I have two gems of ActiveRecord installed
(1.15.3 and 2.0.2). I simply want a program to run using 1.15.3.

Here are the different ways I've tried to do it, all of which fail with the
exceptions shown:

require 'rubygems'
gem 'activerecord', '=1.15.3'
ActiveRecord # >> uninitialized constant ActiveRecord

require 'rubygems'
gem 'activerecord', '=1.15.3'
require 'activerecord' # >> can't activate activerecord (= 2.0.2), already activated activerecord-1.15.3]

require 'rubygems'
require_gem 'activerecord', '=1.15.3' # >> undefined method require_gem

require 'rubygems'
require 'activerecord', '=1.15.3' # >> wrong number of arguments (2 for 1)

require 'rubygems'
require 'gemconfigure'
Gem.configure([['activerecord','=1.15.3']])
ActiveRecord # >> uninitialized constant ActiveRecord

require 'rubygems'
require 'gemconfigure'
Gem.configure([['activerecord','=1.15.3']])
require 'activerecord' # >> can't activate activerecord (= 2.0.2), already activated activerecord-1.15.3]

I see that rubygems-1.1.0 and 1.1.1 have now been released, but see nothing
in the changelogs which suggest that this was a known or fixed issue.
Equally, this is such core behaviour that it can't be broken, or someone
else would have noticed, so I'm sure I'm simply doing it wrong.

Could someone enlighten me please? I am failing to get it to DWIM :-)

Thanks,

Brian.

2 Answers

Jano Svitok

4/11/2008 11:29:00 AM

0

On Fri, Apr 11, 2008 at 1:18 PM, Brian Candler <B.Candler@pobox.com> wrote:
> I wonder if someone can help with a problem which I'm sure is very simple
> and obvious, but I'm tearing my hair out.
>
> I have rubygems 1.0.1 installed. I have two gems of ActiveRecord installed
> (1.15.3 and 2.0.2). I simply want a program to run using 1.15.3.
>
> Here are the different ways I've tried to do it, all of which fail with the
> exceptions shown:
>
> require 'rubygems'
> gem 'activerecord', '=1.15.3'
> ActiveRecord # >> uninitialized constant ActiveRecord
>
> require 'rubygems'
> gem 'activerecord', '=1.15.3'
> require 'activerecord' # >> can't activate activerecord (= 2.0.2), already activated activerecord-1.15.3]
>
> require 'rubygems'
> require_gem 'activerecord', '=1.15.3' # >> undefined method require_gem
>
> require 'rubygems'
> require 'activerecord', '=1.15.3' # >> wrong number of arguments (2 for 1)
>
> require 'rubygems'
> require 'gemconfigure'
> Gem.configure([['activerecord','=1.15.3']])
> ActiveRecord # >> uninitialized constant ActiveRecord
>
> require 'rubygems'
> require 'gemconfigure'
> Gem.configure([['activerecord','=1.15.3']])
> require 'activerecord' # >> can't activate activerecord (= 2.0.2), already activated activerecord-1.15.3]
>
> I see that rubygems-1.1.0 and 1.1.1 have now been released, but see nothing
> in the changelogs which suggest that this was a known or fixed issue.
> Equally, this is such core behaviour that it can't be broken, or someone
> else would have noticed, so I'm sure I'm simply doing it wrong.
>
> Could someone enlighten me please? I am failing to get it to DWIM :-)
>
> Thanks,
>
> Brian.

http://rubyforge.org/tracker/index.php?func=detail&aid=16739&group_id=126&am...

Brian Candler

4/11/2008 12:05:00 PM

0

> http://rubyforge.org/tracker/index.php?func=detail&aid=16739&group_id=126&am...

Thanks for the quick response. So the magic incantation is:

require 'rubygems'
gem 'activerecord', '=1.15.3'
require 'active_record'
ActiveRecord # >> works!

Cheers,

Brian.