From 7d7046254285f9dfe5ac61d33f6f960a19c75570 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 4 Mar 2021 15:47:48 -0800 Subject: [PATCH] [refactor] Clean up unused code --- app/controllers/ticket_purchases_controller.rb | 6 +++--- app/models/ticket_purchase.rb | 5 ----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/app/controllers/ticket_purchases_controller.rb b/app/controllers/ticket_purchases_controller.rb index 60ea5b98..83c53ad0 100644 --- a/app/controllers/ticket_purchases_controller.rb +++ b/app/controllers/ticket_purchases_controller.rb @@ -41,15 +41,15 @@ class TicketPurchasesController < ApplicationController if @conference.registration_ticket_required? && count_registration_tickets_after == 0 redirect_to conference_tickets_path(@conference.short_title), error: 'Please get at least one registration ticket to continue.' - return + return end # Current user didn't have a registration ticket and is purchasing one if count_registration_tickets_before == 0 && count_registration_tickets_after == 1 redirect_to new_conference_conference_registration_path(@conference.short_title) - else + else redirect_to conference_physical_tickets_path - end + end end def index diff --git a/app/models/ticket_purchase.rb b/app/models/ticket_purchase.rb index 74266d91..46a5befe 100644 --- a/app/models/ticket_purchase.rb +++ b/app/models/ticket_purchase.rb @@ -110,11 +110,6 @@ class TicketPurchase < ApplicationRecord errors.add(:quantity, 'cannot be greater than one for registration tickets.') end end - - # def has_registration_ticket_for?(conference) - # # BUG: ticket_purchase has only one ticket? - # ticket.try(:registration_ticket?) - # end end private