salsify/goldiloader

Models loaded via eager_load don't auto eager load nested associations

Closed this issue · 1 comments

Here's a test case:

blogs = Blog.order(:name).eager_load(:posts).to_a
blogs.first.posts.to_a.first.author

blogs.flat_map(&:posts).drop(1).each do |blog|
  expect(blog.association(:author)).to be_loaded
end

Note this is not a problem for associations loaded via includes or preload.