0
votes

I'm developing a subscription based website with Rails 3 and I need to use PayPal Express Checkout (UK) for recurring payments. I've found that it's not supported by default in ActiveMerchant and so I came across the folowing blog post: http://rayvinly.com/articles/2009/02/20/paypal-recurring-billing-with-activemerchant-in-ruby-on-rails/

Being very new to Rails and following the method for installing other third party code by using the Gemfile and bundle install, I tried to add this to the Gemfile:

gem 'active_merchant', :git => 'https://github.com/rayvinly/active_merchant.git'

and then ran bundle install. I get the following error:

Updating https://github.com/rayvinly/active_merchant.git
Fetching source index for http://rubygems.org/
Could not find gem 'active_merchant (>= 0)' in https://github.com/rayvinly/active_merchant.git (at master).
Source does not contain any versions of 'active_merchant (>= 0)'

I'm not sure that's the correct way to get this into my project.

What I really want to do is have the latest ActiveMerchant gem installed and then add just the extra Gateway part that Raymond has created. However I can't seem to find out where I'd need to put the file in my project as I'm not sure where ActiveMerchant IS?

Can any one point me in the right direction for this? this maybe a Rails 101 thing I've missed but I just can't seem to see it. I'm still getting my head around the Rails way! coming from 10 years with PHP.

Thanks in advance for any assistance.

2

2 Answers

1
votes

Generally you can only install from a git repo if there is a <gemname>.gemspec file present. Most Gem master archives includes this, but some, for whatever reason, do not, instead generating it as required before building the gem. This has the side-effect of making it difficult to install the "edge" version of the gem.

You can fix this by forking that repository and building your own active_merchant.gemspec file which will make it installable from your branch.

0
votes

There is a .gemspec file in the most recent version of the shopify repository, if you pull it into yours, then your gem line needs to look like the following:

gem 'activemerchant', :git => 'https://github.com/rayvinly/active_merchant.git'

Note no underscore in the gem name.