uninitialized constant ActiveMerchant::Billing::CreditCard::Validateable (NameError) - in Spree shop

1.5k views Asked by At

i'm new in rails. Today i tried deploy my shop(SpreeShop) to new production server, but somthing was wrong. I have foolowing problem with some gem: activemerchant (1.34.1).

Bellow is my stack trace.

uninitialized constant ActiveMerchant::Billing::CreditCard::Validateable (NameError)
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/activemerchant-1.34.1/lib/active_merchant/billing/credit_card.rb:51:in `<class:CreditCard>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/activemerchant-1.34.1/lib/active_merchant/billing/credit_card.rb:49:in `<module:Billing>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/activemerchant-1.34.1/lib/active_merchant/billing/credit_card.rb:6:in `<module:ActiveMerchant>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/activemerchant-1.34.1/lib/active_merchant/billing/credit_card.rb:5:in `<top (required)>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/activemerchant-1.34.1/lib/active_merchant/billing.rb:5:in `<top (required)>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/activemerchant-1.34.1/lib/active_merchant.rb:56:in `<top (required)>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/bundler/gems/spree-3a3652adb1e8/core/lib/spree/core.rb:8:in `<top (required)>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/bundler/gems/spree-3a3652adb1e8/core/lib/spree_core.rb:1:in `require'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/bundler/gems/spree-3a3652adb1e8/core/lib/spree_core.rb:1:in `<top (required)>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/bundler/gems/spree-3a3652adb1e8/lib/spree.rb:1:in `require'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/bundler/gems/spree-3a3652adb1e8/lib/spree.rb:1:in `<top (required)>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@global/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
  /home/dp/dp/releases/20150607162220/config/application.rb:7:in `<top (required)>'
  /home/dp/dp/releases/20150607162220/config/environment.rb:2:in `require'
  /home/dp/dp/releases/20150607162220/config/environment.rb:2:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
  config.ru:1:in `new'
  config.ru:1:in `<main>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@quiselle/gems/passenger-4.0.26/helper-scripts/rack-preloader.rb:105:in `eval'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/passenger-4.0.26/helper-scripts/rack-preloader.rb:105:in `preload_app'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/passenger-4.0.26/helper-scripts/rack-preloader.rb:150:in `<module:App>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/passenger-4.0.26/helper-scripts/rack-preloader.rb:29:in `<module:PhusionPassenger>'
  /home/dp/.rvm/gems/ruby-1.9.3-p429@dp/gems/passenger-4.0.26/helper-scripts/rack-preloader.rb:28:in `<main>'

Do you have any idea how to resolve this problem??? I was read another post with similar problems but nothing wasnt helpfull....

2

There are 2 answers

1
Prakash Murthy On BEST ANSWER

This is the same issue detailed at https://github.com/Shopify/active_utils/issues/57 .

The fix for the issue was included into active_merchant gem on Jan 15th, 2015 and is available in activemerchant versions 1.47.0 or higher.

So to fix the issue on your rails app, update the activemerchant gem version. The steps would be as follows:

  1. Modify Gemfile and set the active_merchant gem version with gem 'activemerchant', '1.50.0'
  2. Run bundle install

Any version of activemerchant gem higher than 1.47.0 can be used.

Update

The active_merchant-payu gem doesn't depend on any specific version of activemerchant. Run bundle update to force it to use the latest version of activemerchant gem.

0
scarver2 On

The uninitialized constant ActiveMerchant::Billing::CreditCard::Validateable issue is with the version of active_utils gem. Version 3 throws the error; version 2 does not. You need to set the gem version in your Gemfile.

# Gemfile
gem 'active_utils',  '2.0.2'
gem 'activemerchant', '~> 1.32.1', require: 'active_merchant'