Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 分条不同的计划_Ruby On Rails - Fatal编程技术网

Ruby on rails 分条不同的计划

Ruby on rails 分条不同的计划,ruby-on-rails,Ruby On Rails,所以我得到了条纹和运行,但我有3个不同的付款计划。 我想捕获他们单击的计划,并使用它将他们连接到正确的计划id 这是我的表单的外观: <%= form_tag charges_path, id: "payment-form" do %> <span class="payment-errors"></span> <div class="form-row"> <label> <span>Card

所以我得到了条纹和运行,但我有3个不同的付款计划。 我想捕获他们单击的计划,并使用它将他们连接到正确的计划id

这是我的表单的外观:

<%= form_tag charges_path, id: "payment-form" do %>
  <span class="payment-errors"></span>


  <div class="form-row">
    <label>
      <span>Card Number</span>
      <input type="text" size="20" data-stripe="number" maxlength="20" />
    </label>
  </div>

  <div class="form-row">
    <label>
      <span>CVC</span>
      <input type="text" size="4" data-stripe="cvc" maxlength="4"/>
    </label>
  </div>

  <div class="form-row">
    <label>
      <span>Expiration (MM/YYYY)</span>
      <input type="text" size="2" data-stripe="exp-month" maxlength="2"/>
    </label>
    <span> / </span>
    <input type="text" size="4" data-stripe="exp-year" maxlength="4"/>
  </div>

  <button type="submit">Submit Payment</button>
<% end %>
这会导致错误:

undefined local variable or method `plan_id'
def create
  customer = Stripe::Customer.create(
    :email => 'exaimple@stripe.com',
    :plan => plan_id,
    :card  => params[:stripeToken]
  )
  current_user.update_attributes(:stripe_customer_token => customer.id)
  redirect_to root_url, notice: 'Successfully subscribed'
  rescue Stripe::CardError => e
    flash[:error] = e.message
    redirect_to charges_path
  end
undefined local variable or method `plan_id'