-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
I ran into a strange bug. I have an object that embeds several instances of another. Until I persist the parent, the count of the embedded objects is 0. Here's the code:
Parent:
{{ embeds_many :segments, cascade_callbacks: true}}
Segment:
{{ embedded_in :parent}}
1.9.3p125 :061 > q = Parent.new => #<Parent _id: 51b91f26679d6b943f00001b, ...> 1.9.3p125 :062 > q.segments = [Segment.new, Segment.new] => [#<Segment _id: 51b91f2b679d6b943f00001c, >, #<Segment _id: 51b91f2b679d6b943f00001d, >] 1.9.3p125 :064 > q.segments.count => 0