module Bullet::ActiveRecord
def to_a
if select a collection of objects, then these objects have possible to cause N+1 query.
def to_a records = origin_to_a if Bullet.start? if records.size > 1 Bullet::Detector::NPlusOneQuery.add_possible_objects(records) Bullet::Detector::CounterCache.add_possible_objects(records) elsif records.size == 1 Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first) Bullet::Detector::CounterCache.add_impossible_object(records.first) end end records end