In the User model, a has_many :through association 'User#physical_tickets' which goes through 'User#ticket_purchases' was defined before the through association was defined. This doesn't work in Rails 5.1.