8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/gemgento/user/recurring_profiles_controller.rb', line 8
def destroy
recurring_profile = RecurringProfile.find_by!(id: params[:id], user: current_user)
respond_to do |format|
result = recurring_profile.change_state('cancel')
if result == true
format.json { render json: { status: true } }
format.html do
flash[:notice] = 'The recurring profile has been canceled.'
redirect_to action: 'index'
end
else
format.json { render json: { errors: result }, status: 422 }
format.html do
flash[:warning] = result
redirect_to action: 'index'
end
end
end
end
|