title: Config settings for active_merchant to be compatible with a Rails 3 app
body: <p>I'm following <a href="http://railscasts.com/episodes/145-integrating-active-merchant" rel="nofollow">http://railscasts.com/episodes/145-integrating-active-merchant</a></p>
  
  <p>How do I set the configuration settings to be compatible with a Rails 3 app.</p>
  
  <p>I tried putting the following in <code>config/initializers/active_merchant.rb</code></p>
  
  <pre><code>if Rails.env == 'development'
    config.after_initialize do
      ActiveMerchant::Billing::Base.mode = :test
      ::GATEWAY = ActiveMerchant::Billing::PaypalGateway.new(
        :login     =&gt; 'seller12341234zxcv.foobar.com',
        :password  =&gt; 'pasword',
        :signature =&gt; '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     =&gt; 'seller12341234zxcv.foobar.com',
        :password  =&gt; 'pasword',
        :signature =&gt; 'abc123'
      )
    end
  end
  </code></pre>
  
  <p>The following renders an error:</p>
  
  <pre><code>config/initializers/active_merchant.rb:2:in `&lt;top (required)&gt;': undefined local variable or method `config' for main:Object (NameError)
  </code></pre>