views:

315

answers:

3

I am trying to run ActiveMerchant gem with old version of Rails (1.2.6). And if I require active_merchant gem i get this error:

config/boot.rb:17:Warning: Gem::SourceIndex#search support for String patterns is deprecated, use #find_name
/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:280:in `activate': can't activate activesupport (>= 2.3.2, runtime) for ["activemerchant-1.4.2"], already activated activesupport-1.4.4 for ["rails-1.2.6"] (Gem::LoadError)
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:296:in `activate'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:295:in `each'
        from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:295:in `activate'

Upgrading rails is not possible. So what should I do? Maybe i can use older version of ActiveMerchant if so what version works with rails 1.2.6?

+1  A: 

Try installing as a plugin:

git clone git://github.com/Shopify/active_merchant.git vendor/plugins/active_merchant
pjb3
I don't think that will work out of the box, as it appears that the plugin requires activesupport >= 2.0.0 in lib/active_merchant.rb: http://github.com/Shopify/active_merchant/blob/master/lib/active_merchant.rb#L31
Greg Campbell
It works, see line 28. Since that succeeds, it never reaches line 31.
pjb3
This is probably the best approach to take in this situation. I have an app that is still Rails 1.2.6 and this issue has come up several times. After the second time, we just forked ActiveMerchant and installed as a plugin. We now maintain our own version of AM on Github for the older rails app. AM really does not change that often. Most of the code is stable and well tested with the majority of new changes being new Gateways. We use two gateways with the older Rails app, so the new additions don't really concern us.
Phil
A: 

If you're going to actively develop your app with new features, take the time to upgrade to rails 2.3.

It's a pain, I agree, but sticking with an old version of Rails and using newer, incompatible gems is going to be far worse!

Take the time to invest in a Rails upgrade and you'll be very happy you did. Imagine all the rails 2.x goodness you'll get!

Ariejan
The question says "Upgrading rails is not possible."
pjb3
A: 

As Ariejan says, updating to Rails 2.3 is the best thing you can do.

Active Merchant doesn't tags their project for different versions. So you can't rely on it. However you can use an old commit from when Rails 1.2.6 was released.

The release is the 24th november 2007 So using the datas as they were at the last commit just before that release should work.

However I wouldn't advise you to do that. If there's been a security update since that moment (and it was two years ago. So you can be pretty sure there was), you are including a security hole to your application.
Once again, upgrading to Rails 2.3 is the best option you can take here.

Damien MATHIEU
The question says "Upgrading rails is not possible." You can't say upgrading to Rails 2.3 is the best option without knowing more about the situation.
pjb3
Thanks for voting down. I know doing that isn't appropriate. And I thought I enough mentionned the fact that upgrading is way better.
Damien MATHIEU