mongoid/mongoid — Issue #1479: has_and_belongs_to_many duplicate associations
Author: sausman
Created: 2011-12-06 07:58:53+00:00
State: open

```ruby

class Post
include Mongoid::Document
has_and_belongs_to_many :tags
end

class Tag
include Mongoid::Document
has_and_belongs_to_many :posts
end

Loading development environment (Rails 3.1.3)
ruby-1.9.3-p0 :001 > t = Tag.create
=> #
ruby-1.9.3-p0 :002 > t.posts.create
=> #
ruby-1.9.3-p0 :003 > t
=> #
ruby-1.9.3-p0 :004 > t.reload
=> #

```

When a new post is created for a tag, the post's id gets added to post_ids twice.

using mongoid 2.3.4

Can anyone replicate this?