Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/glacials/splits-io. a speedrunning data store and analysis engine splits.io
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233class SubscriptionsController < ApplicationController before_action :set_subscription, only: %i[update destroy]
def index end
def show end
def update @subscription.change_plan!(subscription_params[:stripe_plan_id])
redirect_to(subscriptions_path, notice: 'Subscription plan changed!') end
# This endpoint is only hit by first party JavaScript def destroy @subscription.cancel!
redirect_to(subscriptions_path, notice: 'Subscription canceled.') end
private
def set_subscription @subscription = current_user.subscriptions.active.first end
def subscription_params params.require(:subscription).permit(:stripe_plan_id) endend