module Bullet::ActiveRecord
def construct_model(record, node, row, model_cache, id, aliases)
def construct_model(record, node, row, model_cache, id, aliases) result = origin_construct_model(record, node, row, model_cache, id, aliases) if Bullet.start? associations = [node.reflection.name] if node.reflection.nested? associations << node.reflection.through_reflection.name end associations.each do |association| Bullet::Detector::Association.add_object_associations(record, association) Bullet::Detector::NPlusOneQuery.call_association(record, association) @bullet_eager_loadings[record.class] ||= {} @bullet_eager_loadings[record.class][record] ||= Set.new @bullet_eager_loadings[record.class][record] << association end end result end