Trying (and failing) to load specific version of gem

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 :slight_smile:

Thanks,

Brian.

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

···

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 :slight_smile:

Thanks,

Brian.

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

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

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

Cheers,

Brian.