2014-01-23 37 views
0

我試圖實現條帶更改訂閱的方式。我對我的代碼有些困惑。目前,我有以下幾點:帶下拉導軌的條帶更改訂閱

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' 

,並在我的編輯視圖我有這樣的僞碼我想要得到的工作

<div class="form-group"> 
    <%= collection_select(drop_down_of_subscription_types) %> 
    <%= link_to "post request to 'subscribe#changeSubscription' with type sent" %> 
    </div> 
幫助
+0

您錯過了一個表格(

我猜。 – techvineet

回答

0

使用submit_tag呈現表單的提交按鈕。

link_to and button_to will not working