我正在关注http://railscasts.com/episodes/145-integrating-active-merchant
如何设置配置设置以与 Rails 3 应用程序兼容。
我尝试将以下内容放入config/initializers/active_merchant.rb
if Rails.env == 'development'
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
:login => 'seller12341234zxcv.foobar.com',
:password => 'pasword',
:signature => 'abc123'
)
end
elsif Rails.env == 'test'
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::BogusGateway.new
end
elsif Rails.env == 'production'
config.after_initialize do
ActiveMerchant::Billing::Base.mode = :test
::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
:login => 'seller12341234zxcv.foobar.com',
:password => 'pasword',
:signature => 'abc123'
)
end
end
以下呈现错误:
config/initializers/active_merchant.rb:2:in `<top (required)>': undefined local variable or method `config' for main:Object (NameError)