Activemerchant rails 3.1 wrong number of arguments

Hi,

Ive followed the railscasts to integrate paypal express and activemerchant on rails 2.5 without any issues #146 PayPal Express Checkout - RailsCasts.

When using the same code in a rails 3.1 app i get the following error below, this happens when i try to set the purchase up:

EXPRESS_GATEWAY.setup_purchase(100, {:return_url => "www.bbc.co.uk", :cancel_return_url => "www.bbc.co.uk"})

ArgumentError: wrong number of arguments (1 for 0)         from /Users/jxxxxxxxxxr/.rvm/gems/ ree-1.8.7-2010.02@mystaffdeals/gems/ builder-3.0.0/lib/builder/xmlbase.rb:135:in `to_xs'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlbase.rb:135:in `_escape'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlbase.rb:140:in `_escape_quote'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlmarkup.rb:320:in `_attr_value'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlmarkup.rb:311:in `_insert_attributes'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlmarkup.rb:310:in `each'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlmarkup.rb:310:in `_insert_attributes'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlmarkup.rb:293:in `_start_tag'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlbase.rb:60:in `method_missing'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlbase.rb:34:in `tag!'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ activemerchant-1.18.1/lib/active_merchant/billing/gateways/ paypal_express.rb:97:in `build_setup_request'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ activemerchant-1.18.1/lib/active_merchant/billing/gateways/ paypal_express.rb:25:in `setup_purchase'

Ive also followed this tutorial

and get the same error message above when i try the gateway.setup_purchase method.

Anybody got any ideas, im really stuck now. Ive tried everything i can think off, different versions of the activemerchant gem, etc etc etc

JB

John Butler wrote in post #1032006:

Hi,

Ive followed the railscasts to integrate paypal express and activemerchant on rails 2.5 without any issues #146 PayPal Express Checkout - RailsCasts.

When using the same code in a rails 3.1 app i get the following error below, this happens when i try to set the purchase up:

EXPRESS_GATEWAY.setup_purchase(100, {:return_url => "www.bbc.co.uk", :cancel_return_url => "www.bbc.co.uk"})

ArgumentError: wrong number of arguments (1 for 0)         from /Users/jxxxxxxxxxr/.rvm/gems/ ree-1.8.7-2010.02@mystaffdeals/gems/ builder-3.0.0/lib/builder/xmlbase.rb:135:in `to_xs'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/ gems/ builder-3.0.0/lib/builder/xmlbase.rb:135:in `_escape'         from /Users/xxxxxxxx/.rvm/gems/ree-1.8.7-2010.02@mystaffdeals/

JB

this issue due to hpricot gem with ruby 1.8.7 if you remove hpricot you can fix this issue