I am receiving the errors below when I try to view two specific Models through ActiveAdmin's dashboard. Everything I've read points to a possible association issue, but I am not sure how to correct it. I see a lot of people having the same problems but haven't found any solutions to it. Any help would be much appreciated.
NoMethodError in Admin::Listings#index
undefined method `klass' for nil:NilClass
or
NoMethodError in Admin::Buildings#index
undefined method `klass' for nil:NilClass
Models
class Company < ApplicationRecord
has_many :appointments, through: :listings, dependent: :destroy
has_many :listings, through: :users, dependent: :destroy
has_many :buildings, through: :users, dependent: :destroy
has_many :users, dependent: :destroy
end
class User < ApplicationRecord
belongs_to :company
has_many :apointments, through: :listings
has_many :listings, through: :buildings
has_many :buildings
end
class Listing < ApplicationRecord
has_many :companies, through: :users
has_many :users, through: :buildings
belongs_to :building
has_many :appointments
end
class Building < ApplicationRecord
has_many :companies, through: :users
belongs_to :user
has_many :appointments, through: :listings
has_many :listings, dependent: :destroy
end
class Appointment < ApplicationRecord
belongs_to :listing
has_many :companies, through: :listings
end