这按预期工作:
[1] consum » node = Node.new(name: "p")
=> #<Node:0x007ff032b941d0> {
:_id => "51e88c41c7e9680108000001",
:name => "p",
:parent_ids => [],
:repeated => false
}
[2] consum » node.children
=> []
这不会:
[3] consum » node = Node.create(name: "p")
=> #<Node:0x007ff03250a6c0> {
:_id => "51e88c4dc7e9680108000002",
:created_at => 2013-07-19 00:46:05 UTC,
:name => "p",
:parent_ids => [],
:repeated => false,
:updated_at => 2013-07-19 00:46:05 UTC
}
[4] consum » node.children
=> nil