Skip to content

Commit daaba73

Browse files
authored
Fix should_use_cache check to avoid calling it on the wrong class. (#454)
1 parent 088269e commit daaba73

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/identity_cache/cached/prefetcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def prefetch(klass, associations, records, load_strategy: LoadStrategy::Eager)
3737
private
3838

3939
def fetch_association(load_strategy, klass, association, records, &block)
40-
unless records.first.class.should_use_cache?
40+
unless klass.should_use_cache?
4141
ActiveRecord::Associations::Preloader.new.preload(records, association)
4242
return yield
4343
end

0 commit comments

Comments
 (0)