# Specifying a gem version

**URL:** <https://www.ruby-forum.com/t/specifying-a-gem-version/78264>\
**Category:** Ruby\
**Created:** [December 4, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/specifying-a-gem-version/78264 "2006-12-04T18:10:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![madscene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@madscene](https://www.ruby-forum.com/u/madscene)\
**Post date:** [December 4, 2006, 6:10pm UTC](https://www.ruby-forum.com/t/specifying-a-gem-version/78264/1 "2006-12-04T18:10:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![madscene](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/5f9b8f/32.png) [@madscene](https://www.ruby-forum.com/u/madscene)\
**Post date:** [December 4, 2006, 11:35pm UTC](https://www.ruby-forum.com/t/specifying-a-gem-version/78264/2 "2006-12-04T23:35:30Z")

</div>

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.
