checking if no tickets are purchased.
passing tests.
This commit is contained in:
parent
5ad99e1cd8
commit
5a19d47376
1 changed files with 3 additions and 1 deletions
|
|
@ -87,7 +87,9 @@ class ConferenceRegistrationsController < ApplicationController
|
||||||
def destroy
|
def destroy
|
||||||
tickets_purchased = TicketPurchase.find_by(conference_id: @registration.conference_id)
|
tickets_purchased = TicketPurchase.find_by(conference_id: @registration.conference_id)
|
||||||
if @registration.destroy
|
if @registration.destroy
|
||||||
tickets_purchased.destroy
|
if tickets_purchased
|
||||||
|
tickets_purchased.destroy
|
||||||
|
end
|
||||||
redirect_to root_path,
|
redirect_to root_path,
|
||||||
notice: "You are not registered for #{@conference.title} anymore!"
|
notice: "You are not registered for #{@conference.title} anymore!"
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue