lib/bullet/mongoid2x.rb in bullet-4.4.0 vs lib/bullet/mongoid2x.rb in bullet-4.5.0
- old
+ new
@@ -9,35 +9,35 @@
alias_method :origin_iterate, :iterate
alias_method :origin_eager_load, :eager_load
def first
result = origin_first
- Bullet::Detector::Association.add_impossible_object(result) if result
+ Bullet::Detector::NPlusOneQuery.add_impossible_object(result) if result
result
end
def last
result = origin_last
- Bullet::Detector::Association.add_impossible_object(result) if result
+ Bullet::Detector::NPlusOneQuery.add_impossible_object(result) if result
result
end
def iterate(&block)
records = execute.to_a
if records.size > 1
- Bullet::Detector::Association.add_possible_objects(records)
+ Bullet::Detector::NPlusOneQuery.add_possible_objects(records)
elsif records.size == 1
- Bullet::Detector::Association.add_impossible_object(records.first)
+ Bullet::Detector::NPlusOneQuery.add_impossible_object(records.first)
end
origin_iterate(&block)
end
def eager_load(docs)
associations = criteria.inclusions.map(&:name)
docs.each do |doc|
Bullet::Detector::Association.add_object_associations(doc, associations)
end
- Bullet::Detector::Association.add_eager_loadings(docs, associations)
+ Bullet::Detector::UnusedEagerLoading.add_eager_loadings(docs, associations)
origin_eager_load(docs)
end
end
::Mongoid::Relations::Accessors.class_eval do