class Bullet::Detector::NPlusOneQuery

def association?(object, associations)

Experimental RBS support (using type sampling data from the type_fusion project).

def association?: ((User | UserTrade) object, Symbol associations) -> true

This signature was generated using 9 samples from 1 application.

check if object => associations already exists in object_associations.
def association?(object, associations)
  value = object_associations[object.bullet_key]
  value&.each do |v|
    # associations == v comparison order is important here because
    # v variable might be a squeel node where :== method is redefined,
    # so it does not compare values at all and return unexpected results
    result = v.is_a?(Hash) ? v.key?(associations) : associations == v
    return true if result
  end
  false
end