deleting all associated tickets to a user

This commit is contained in:
Rishabh Saxena 2016-03-11 14:59:44 +05:30
parent 297b1f8c8a
commit ac066b0546

View file

@ -85,7 +85,7 @@ class ConferenceRegistrationsController < ApplicationController
end end
def destroy def destroy
tickets_purchased = TicketPurchase.find_by(conference_id: @registration.conference_id) tickets_purchased = TicketPurchase.where(conference_id: @registration.conference_id)
if @registration.destroy if @registration.destroy
if tickets_purchased if tickets_purchased
tickets_purchased.destroy tickets_purchased.destroy