Getting started with ActiveMerchant & new Ecommerce book

Hi there

I've got a copy of the 'Beginning Ruby on Rails Ecommerce' book and am
trying to integrate ActiveMerchant into my app.

My order.rb file has the line:

'include ActiveMerchant::Billing'

per the book.

My Order model also has, amongst other things, the following validation:

' validates_inclusion_of :billing_country, :in => {|disp, value| value}'

where the constant COUNTRIES has been defined in my Address model.

From the console, if I try and create an, I get the following error:

'uninitialized constant COUNTRIES' and reference to the above validation.

Any clues on whether I'm actually including ActiveMerchant the correct
way and why it is clashing with my Address model?

I thought I only needed to 'require 'active_merchant' in my environment.rb file?

All my gateway tests, including the remote ones, pass out of the box,
but I just have to integrate into my app.

Any clues would be appreciated.

If you install ActiveMerchant into vendor/plugins/active_merchant you
don't even have to require it because we include an init.rb file that
Rails will load automatically.

You problem is that there is in fact an Address class in
ActiveMerchant::Billing that is conflicting with your Address class.
The solution to this is just to not include ActiveMerchant:Billing,
but to include ActiveMerchant. Then just prefix the ActiveMerchant
classes with Billing:

Or don't include anything and do: