class Bullet::Detector::NPlusOneQuery
def call_association(object, associations)
then, it checks if this associations call is unpreload.
first, it keeps this method call for object.association.
executed when object.associations is called.
def call_association(object, associations) return unless Bullet.start? return unless Bullet.n_plus_one_query_enable? return unless object.bullet_primary_key_value return if inversed_objects.include?(object.bullet_key, associations) add_call_object_associations(object, associations) Bullet.debug( 'Detector::NPlusOneQuery#call_association', "object: #{object.bullet_key}, associations: #{associations}" ) if !excluded_stacktrace_path? && conditions_met?(object, associations) Bullet.debug('detect n + 1 query', "object: #{object.bullet_key}, associations: #{associations}") create_notification(caller_in_project(object.bullet_key), object.class.to_s, associations) end end