Gem 使用 padrino + activemerchant_patch_for_china 遇到的问题

grant · 2013年05月07日 · 最后由 luikore 回复于 2013年05月08日 · 3230 次阅读

最近使用 padrino(0.11.1) + activemerchant_patch_for_china(0.2.0) 的时候。 遇到如下错误,有经验的大神可以指导一下怎么解决吗?谢谢:)

页面代码

<% payment_service_for 'X0000001', ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT,
                            :service => :alipay,
                            :html => { :id => 'payment-form', :method => :get } do |service| %>
  <% service.total_fee 0.02 %>
  <% service.seller :email => ActiveMerchant::Billing::Integrations::Alipay::EMAIL %>
  <% service.notify_url url_for(:only_path => false, :action => 'notify') %>
  <% service.return_url url_for(:only_path => false, :action => 'done') %>
  <% service.show_url url_for(:only_path => false, :action => 'show') %>
  <% service.body 'payment body' %>
  <% service.charset "utf-8" %>
  <% service.service ActiveMerchant::Billing::Integrations::Alipay::Helper::CREATE_DIRECT_PAY_BY_USER %>
  <% service.payment_type 1 %>
  <% service.subject 'payment subject' %>
  <% service.sign %>
<% end %>
<%= button_to_function "Submit", "document.getElementById('payment-form').submit()" %>

错误信息 undefined method `call' for nil:NilClass

file: erb_handler.rb location: capture_from_template line: 32


 /home/grant/.rvm/gems/ruby-2.0.0-p0/gems/padrino-helpers-0.11.1/lib/padrino-helpers/output_helpers/erb_handler.rb in capture_from_template

    captured_block = block.call(*args)

/home/grant/.rvm/gems/ruby-2.0.0-p0/gems/padrino-helpers-0.11.1/lib/padrino-helpers/output_helpers.rb in capture_html

    captured_html, captured_block = handler.capture_from_template(*args, &block)

/home/grant/.rvm/gems/ruby-2.0.0-p0/gems/padrino-helpers-0.11.1/lib/padrino-helpers/form_helpers.rb in form_tag

    inner_form_html << mark_safe(capture_html(&block))

/home/grant/.rvm/gems/ruby-2.0.0-p0/gems/activemerchant-1.32.1/lib/active_merchant/billing/integrations/action_view_helper.rb in payment_service_for

    result << form_tag(integration_module.service_url, form_options)

/home/grant/testproject/app/views/test/test.html.erb in block in singleton class

    <% payment_service_for 'X0000001', ActiveMerchant::Billing::Integrations::Alipay::ACCOUNT...

新建个 helper , 将这一大坨代码放进去应该就好了

需要 登录 后方可回复, 如果你还没有账号请 注册新账号