diff --git a/lib/identity_cache/cached/prefetcher.rb b/lib/identity_cache/cached/prefetcher.rb index a5c19124..2aeca23d 100644 --- a/lib/identity_cache/cached/prefetcher.rb +++ b/lib/identity_cache/cached/prefetcher.rb @@ -37,7 +37,7 @@ def prefetch(klass, associations, records, load_strategy: LoadStrategy::Eager) private def fetch_association(load_strategy, klass, association, records, &block) - unless records.first.class.should_use_cache? + unless klass.should_use_cache? ActiveRecord::Associations::Preloader.new.preload(records, association) return yield end