From ff443b2d931420a16e55ff9b866a75b5b397ef2e Mon Sep 17 00:00:00 2001 From: Brian Quinn Date: Sat, 8 Oct 2011 17:07:53 +0100 Subject: [PATCH] Updated PaymentMethods to register correctly --- lib/spree_paypal_express.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/spree_paypal_express.rb b/lib/spree_paypal_express.rb index e8dfb75..48ef779 100644 --- a/lib/spree_paypal_express.rb +++ b/lib/spree_paypal_express.rb @@ -7,16 +7,17 @@ module SpreePaypalExpress config.autoload_paths += %W(#{config.root}/lib) def self.activate - #workaround for https://github.com/Shopify/active_merchant/issuesearch?state=open&q=paypal#issue/43 - require 'active_merchant' - ActiveMerchant::Billing::PaypalExpressGateway - + debugger Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c| Rails.env.production? ? require(c) : load(c) end + end - BillingIntegration::PaypalExpress.register - BillingIntegration::PaypalExpressUk.register + initializer "spree_paypal_express.register.payment_methods" do |app| + app.config.spree.payment_methods += [ + BillingIntegration::PaypalExpress, + BillingIntegration::PaypalExpressUk + ] end config.to_prepare &method(:activate).to_proc