Validating the presence of a foreign key?

The problem is that user_group.id is nil, so when build is called, the
child User object that's created has a nil foreign key. The save on
the next line fails for this reason. If you replace UserGroup.new with
UserGroup.create!, I'll bet it would work.

That's my take, at least, and it matches the behavior I've seen: You
have to save the new parent before adding children. This does not
match my understanding of the Agile book, but I've written some tests,
and that's what seems to be necessary.

///ark