-
Notifications
You must be signed in to change notification settings - Fork 443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Eager Loading Detected
if use before_all
or let_it_be
#666
Comments
@chaomao The solution comes to my mind is
But it's not simple and I'm not sure if I have time to do it right now. Or you can skip the bullet request for some tests which contains before_all or let_it_be. |
thanks for the reply, I will skip bullet request for some tests for now :) |
I'm encountering this issue as well. A workaround we discovered is to use |
Yes |
Hi, zm
recently I start refactoring our test, move large object creation from
let
to let_it_be, which will change object creation frombefore_each
hook intobefore_all
hook, then I found some tests failed due toeager loading detected
, like belowwhich will raise error
USE eager loading detected, Comment => [:post], Add to your query: .includes([:post])
, reproducable repo is here. I don't think the detection is correct :(I read the source code of bullet and found the issue is the object created in
before_all
hook didn't add intoBullet::Detector::NPlusOneQuery::impossible_objects
, because Bullet.start_request is invoked inbefore_each
hook.so my questions are:
eager loading detected
error when I usebefore_all
orlet_it_be
? I really want to move some large object creation out of each test, which will significantly improve performanceThe text was updated successfully, but these errors were encountered: