checking if no tickets are purchased.

passing tests.
This commit is contained in:
Rishabh Saxena 2016-03-10 03:20:15 +05:30
parent 5ad99e1cd8
commit 5a19d47376

View file

@ -87,7 +87,9 @@ class ConferenceRegistrationsController < ApplicationController
def destroy
tickets_purchased = TicketPurchase.find_by(conference_id: @registration.conference_id)
if @registration.destroy
tickets_purchased.destroy
if tickets_purchased
tickets_purchased.destroy
end
redirect_to root_path,
notice: "You are not registered for #{@conference.title} anymore!"
else