-
Notifications
You must be signed in to change notification settings - Fork 451
Open
Labels
Description
When I run the specs I got the following logs which are not complete since they do not include the full stack trace:
Bullet::Notification::UnoptimizedQueryError:
user: victorhazbun
AVOID eager loading detected
AffiliateBrand => [:parent]
Remove from your query: .includes([:parent])
Call stack
/Users/victorhazbun/Code/my-app/spec/support/bullet.rb:12:in `block (2 levels) in <top (required)>'
# ./spec/support/bullet.rb:12:in `block (2 levels) in <top (required)>'
I have the following setup in a spec helper.
RSpec.configure do |config|
config.before(:each, bullet: true) do
Bullet.enable = true
Bullet.bullet_logger = true
Bullet.raise = true # raise an error if n+1 query occurs
Bullet.start_request
end
config.after(:each, bullet: true) do
Bullet.perform_out_of_channel_notifications if Bullet.notification?
Bullet.end_request
Bullet.enable = false
Bullet.bullet_logger = false
Bullet.raise = false
end
end
NOTE: The full stack trace only appears when N+1 issues occur, but not for unused eager loading issues.