Specifying a gem version

I’m new to ruby so I have no clue what I’m doing yet here. I downloaded
active_merchant code and attempted to run some tests using
active_support 1.3.1. That work just fine for me. I upgraded rails to
1.2rc1 and it then downloaded active_support 1.3.1.5618. When I attempt
to run the same tests now with active_support I’m getting an error
because of the new version of active support. I was thinking I could
just specify the older version of active_support and all would be well
but that doesn’t seem to be working. Instead of doing:

begin
require ‘active_support’
rescue LoadError
require ‘rubygems’
require_gem ‘activesupport’
end

I changed this to:

begin
require ‘rubygems’
require_gem ‘activesupport’, ‘<=1.3.1’
rescue LoadError
require ‘rubygems’
require_gem ‘activesupport’
end

I also tried just putting in require_gem ‘activesupport’, ‘1.3.1’ with
no luck. The error I get is something like ‘mattr_accessor’ is
undefined. I’ve read that you can specify the version of a gem so I
must be doing something stupid here. I have put in a ticket on the
rails list about this issue with activesupport but I was hoping to work
around the issue til it was fixed. Thanks in advance.

Brian Mr. wrote:

require ‘active_support’
rescue LoadError

Do you -need- the newer version of AS or are you just chasing higher
version numbers? Or did rails pick up the incompatible version as a
dependency?

If the former is the case, wipe clean, and just use the version rails
asks for. If the latter, if that’s somehow Rails-specific code, maybe
the activesupport gem was already loaded at the bad version before by
the test launcher, I don’t think different gem versions can at all run
side-by-side.

David V.