bullet icon indicating copy to clipboard operation
bullet copied to clipboard

Is there a bug with whitelisting polymorphic associations?

Open aximuseng opened this issue 3 years ago • 1 comments

I am getting these:

USE eager loading detected
  ActivityTask => [:taskable]
  Add to your query: .includes([:taskable])

The association is polymorphic so I can't add an include so I added a whitelist:

Bullet.add_whitelist type: :unused_eager_loading, class_name: "ActivityTask", association: :taskable

The bullet warnings persist even after adding this.

aximuseng avatar Apr 02 '21 03:04 aximuseng

Broadly, how do we get Bullet to ignore polymorphic associations? It complains that they aren't eagerly loaded, but later complains that they are polymorphic.

Update: I found Bullet.add_safelist to exclude each specific scenario

drnic avatar Nov 21 '22 02:11 drnic