From 1f7877ccd94b4c4e173e508bd9874b81bd0fe941 Mon Sep 17 00:00:00 2001 From: Michael Ball Date: Thu, 9 Jan 2020 01:13:27 -0800 Subject: [PATCH] Re-order Conference Associations The current order leads to an error on the route GET /conferences/:short_name/physical_tickets The Rails error message was rather helpful! :grin: ``` Completed 500 Internal Server Error in 35ms (ActiveRecord: 12.0ms) ActiveRecord::HasManyThroughOrderError (Cannot have a has_many :through association 'Conference#physical_tickets' which goes through 'Conference#ticket_purchases' before the through association is defined.): app/controllers/admin/physical_tickets_controller.rb:11:in `index' ``` --- app/models/conference.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/conference.rb b/app/models/conference.rb index be3c36ad..c48dcf02 100644 --- a/app/models/conference.rb +++ b/app/models/conference.rb @@ -25,8 +25,8 @@ class Conference < ApplicationRecord has_one :email_settings, dependent: :destroy has_one :program, dependent: :destroy has_one :venue, dependent: :destroy - has_many :physical_tickets, through: :ticket_purchases has_many :ticket_purchases, dependent: :destroy + has_many :physical_tickets, through: :ticket_purchases has_many :payments, dependent: :destroy has_many :supporters, through: :ticket_purchases, source: :user has_many :tickets, dependent: :destroy