ページを編集してストライプ サブスクリプションを更新しようとしていますが、何を投げても気に入らないようです。
ここに私のroutes.rbがあります
get 'subscribe' => 'subscribe#stepone'
get 'subscribe/sliding-scale' => 'subscribe#steptwo'
get 'subscribe/sliding-scale/subscriber' => 'subscribe#subscriber'
get 'subscribe/sliding-scale/supporter' => 'subscribe#supporter'
get 'subscribe/sliding-scale/sustainer' => 'subscribe#sustainer'
post 'subscribe/sliding-scale/:type' => 'subscribe#createSubscription'
get 'subscribe/edit' => 'subscribe#edit', :as => :edit_subscription
match '/subscribe/edit', to: 'subscribe#deleteCard', via: :delete
match '/subscribe/edit', to: 'subscribe#updateSubscription', via: :post
post 'subscribe/edit/changeSubscription' => 'subscribe#changeSubscription', :as => :change_subscription
私のサブスクリプションコントローラー:
def changeSubscription
customer = Stripe::Customer.retrieve(@user.stripeCustomerId)
@plan = params[:plan]
@user.update_subscription(:plan => @plan, :prorate => true)
current_role = @user.roles.first.name
@user.remove_role current_role
current_user.add_role params[@plan]
end
そして最後に私の編集ビュー:
<h2>Change My Subscription</h2>
<h3>Your current plan is: <%= current_user.roles.first.name %>
<%= select_tag @plan, options_for_select([['Subscriber'], ['Sustainer'], ['Supporter']]) %>
<%= link_to "Update", change_subscription_path, :confirm => "You sure?", :plan => @plan %>
新しい計画をコントローラに送信して、ローカル ロールと計画の両方を更新しようとしていますが、適切なルートを見つけられないようです。この点で何が間違っているのかわかりません。
ご協力いただきありがとうございます!