You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I guess it looks like a false positive attempt. Is there a way to mute Prosopite when running rails default methods like save, create, or update? Is solution below the only way?
Prosopite.scan
...
Prosopite.pause{Model1.create(name: 'first model 1',model2_ids: [1,2])}
...
Prosopite.finish
The text was updated successfully, but these errors were encountered:
Yes, I am in the same situation. this is a false positive. I am not going to deep dive into Instrument which is what uses this gem to detect the N+1, but it is odd it can not differentiate the arguments in
SELECT "model3s".* FROM "model3s" WHERE "model3s"."id" = $1 LIMIT $2
SELECT "model3s".* FROM "model3s" WHERE "model3s"."id" = $1 LIMIT $2
Only takes into account the query without the arguments, which definitely the difference.
@raulperezalejo I faced the same issue in one of my codebases today.
N same queries happen in one of my logic, but they all have difference values for the first argument $1! Prosopite still flags this as a N+1 issue tho, which is not the case.
Were you able to find a solution for this? Honestly I could just do Prosopite.enabled = false at the end of my test but I'm not very happy with that.
It's related to the rails default behavior connected to the associations assignment. Here my structure of models:
Schema change:
Model classes:
I've seeded some data to demonstrate:
And then I try to create a first record into model1s table under Prosopite scanning:
I guess it looks like a false positive attempt. Is there a way to mute Prosopite when running rails default methods like save, create, or update? Is solution below the only way?
The text was updated successfully, but these errors were encountered: