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

HABTM reload flag non-functional

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

      Mongoid::Document#an_association(true) does not reload the related documents in mongoid 3.0.1. Both with and without identity map.

      class A
        include Mongoid::Document
        has_and_belongs_to_many :bs, inverse_of: :as
      end
      
      class B
        include Mongoid::Document
        has_and_belongs_to_many :as, inverse_of: :bs
      end
      
      A.delete_all; B.delete_all
      
      a = A.create
      puts a.bs.size        # => 0
      
      B.create(:a_ids => [a.id])
      
      puts a.bs.size        # => 0
      puts a.bs(true).size  # => still 0!
      
      a = A.first
      puts a.bs.size        # => 1
      

      Possibly a regression of MONGOID-597?

            Assignee:
            Unassigned Unassigned
            Reporter:
            niels Niels Ganser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: