-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Hi.
I'm using Mongoid 4.0.0 in a Rails 4.1.4 app.
Your docs say the following for REFERENCED 1-1 relations:
>Model#
{name}=
>Set the child document. If the parent document is persisted, then the child will be saved immediately. If setting to nil then the child will be deleted.
Given I have, for example, the following models:
class Parent
include Mongoid::Document
has_one :child
end
class Child
include Mongoid::Document
belongs_to :parent
end
If I do the following:
p = Parent.new
c = Child.new
p.child = c
p.save
It only persists the Parent, not the Child, contradicting your documentation. Is this a bug?, or am I not clear about something?, or missing something?.
Would appreciate your response.
Best regards.