Saturday, 24 August 2013

Eager Loading issue with Bullet Gem

Eager Loading issue with Bullet Gem

I have installed the bullet gem to check for N+1 query issues, but I think
it is incorrectly giving me an N+1 query found notice:
User has_one profile
User has_many posts
In my Users Index action, I have:
User.includes(:profile, :post).where("profiles.city IS NOT
NULL").where("posts IS NOT NULL")
I checked my log and Profile and Posts are being loaded in memory, But I
still get a warning from the gem every time I go to the index gem:
N+1 Query detected
User => [:posts, :profile]
Add to your finder: :include => [:posts, :profile]

No comments:

Post a Comment