salsify/goldiloader

Don't auto eager load associations with instance dependent scopes

Closed this issue · 1 comments

Rails 4 and above support instance dependent association scopes which cannot be eager loaded e.g.

class Blog < ActiveRecord::Base
  has_many :posts, ->(instance) { Post.where(blog_id: instance.id) }, class_name: 'Post'
end

Goldiloader should disable auto eager loading for these associations.

Noticed this because Rails 4.2 added a deprecation warning when attempting to eager load these associations.

Fixed in 5d25767