Class: Bullet::Detector::NPlusOneQuery

Inherits:
Association show all
Defined in:
lib/bullet/detector/n_plus_one_query.rb

Class Method Summary collapse

Methods inherited from Association

add_call_object_associations, add_eager_loadings, add_impossible_object, add_object_associations, add_possible_objects, clear, start_request

Methods inherited from Base

end_request, start_request

Class Method Details

.call_association(object, associations) ⇒ Object

executed when object.assocations is called. first, it keeps this method call for object.association. then, it checks if this associations call is unpreload.

if it is, keeps this unpreload associations and caller.


8
9
10
11
12
13
14
15
16
# File 'lib/bullet/detector/n_plus_one_query.rb', line 8

def self.call_association(object, associations)
  @@checked = true
  add_call_object_associations(object, associations)

  if conditions_met?(object, associations)
    caller_in_project
    create_notification object.class, associations
  end
end