Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-1537

Eager loading doesn't work when querying scoped associations

    • Type: Icon: Task Task
    • Resolution: Done
    • 2.4.1
    • Affects Version/s: None
    • Component/s: None

      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?

            Assignee:
            durran Durran Jordan
            Reporter:
            fbjork Fredrik Björk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: