mongoid/mongoid — Issue #1536: Eager loading doesn't work when querying scoped associations
Author: fbjork
Created: 2011-12-30 20:52:13+00:00
State: open

Given the following:

class User
has_many :accounts
end

class Account
field :name
field :large_array, type: Array

scope :basic, only(:name)

belongs_to :user
end

u = User.includes(:accounts).first

The following won't access the Identity Map:
u.accounts.basic.first

I was expecting that to work. Perhaps I'm doing something wrong?