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

Fixed has_one excessive query.

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

      It really fixes https://github.com/mongoid/mongoid/issues/2701

      The problem is that there seems to be no way for a has_one setter to know, whether assigned object is the same without actually getting the object from DB; so I reversed your path and solved the problem in belongs_to setter. I'm not sure that I did it the best way, but at least I didn't break any existing specs and added one spec to cover the bug.

            Assignee:
            arthurnn Arthur Nogueira Neves
            Reporter:
            exoth Yuriy Trofimenko
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: