Class: Susply::ChangePlansController

Inherits:
ApplicationController show all
Defined in:
app/controllers/susply/change_plans_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/susply/change_plans_controller.rb', line 5

def create
  plan = Susply::Plan.find(params[:plan_id])
  if current_owner.can_change_plan?(plan)
    Susply::ChangeSubscription.call(current_owner, plan)
    redirect_to after_change_plan_success_path,
      notice: t('susply.messages.success_changed_plan')
  else
    redirect_to after_change_plan_fail_path,
      alert: t('susply.messages.failed_changed_plan')
  end
end