我正在尝试实现一种条纹更改订阅的方法。我对我的代码有些困惑。目前我有以下内容:
subscription_controller
def changeSubscription
@user = User.find(params[:id])
@plan = params[:type]
c = Stripe::Customer.retrieve(@user.stripeCustomerId)
c.update_subscription(:plan => @plan, :prorate => true)
end
routes.rb
post 'subscribe/change/:type' => 'subscribe#changeSubscription'
,在我的编辑视图中,我有这个psuedocode,我想帮助工作
<div class="form-group">
<%= collection_select(drop_down_of_subscription_types) %>
<%= link_to "post request to 'subscribe#changeSubscription' with type sent" %>
</div>
使用 submit_tag
渲染表格的提交按钮。
link_to
和button_to
Will 不工作。