-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Hi,
I've got two models with a HABTM relationship:
class Article
include Mongoid::Document
include Mongoid::Timestamps
has_and_belongs_to_many :tags
field :title, :type => String
end
and
class Tag
include Mongoid::Document
include Mongoid::Timestamps
has_and_belongs_to_many :articles
end
If I create a new article using #create everything works fine:
Article.create(:title => "Test", :tag_id => Tag.first.id)
But if I'm using #save, the tag model doesn't know anything about it related articles
article = Article.new(:title => "Test", :tag_id => Tag.first.id)
article.save
I'm using Rails 3.1 and Mongoid 2.2.0. This bug does not exist in Mongoid 2.0.2.