Add test for persisting inverse keys for HABTM substitution

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Setup

       
      class Post
        include Mongoid::Document
      
        has_and_belongs_to_many :tags
      end
      
      class Tag
        include Mongoid::Document
      
        has_and_belongs_to_many :posts
      end
      
      tag = Tag.create
      post = Post.create(tags: [tag])
      post.tags = [Tag.last]
      

      Expected Behavior

      post.reload.tag_ids #=> [tag.id]
      tags.reload.post_ids #=> [post.id]
      

      Actual Behavior

      post.reload.tag_ids #=> [tag.id]
      tag.reload.post_ids #=> []
      

      Commit has a failing test in the many_to_many_spec.rb, but we aren't sure how to fix with out breaking other functionality.

              Assignee:
              Emily Stolfo (Inactive)
              Reporter:
              ersatzryan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: