Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for persisting inverse keys for HABTM substitution #3604

Closed

Conversation

ersatzryan
Copy link

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.

@durran durran added this to the 4.0.1 milestone Apr 22, 2014
@arthurnn arthurnn removed this from the 4.0.1 milestone Feb 15, 2015
@ersatzryan ersatzryan removed this from the 4.0.1 milestone Feb 15, 2015
@akshayrao14
Copy link

Just wondering... Has this issue been fixed yet? I'm Mongoid 4.0.2 and this issue is giving us some pain.

@johnnyshields
Copy link
Contributor

@ersatzryan can you try this on latest Mongoid master to see if still an issue?

@estolfo
Copy link
Contributor

estolfo commented Apr 19, 2017

Fixed in this commit: 8ccd331

@estolfo estolfo closed this Apr 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants