I’m using nested model creation in my forms, but I’ve noticed that
when I go to try and destroy a nested model, the backing DB row gets
destroyed but the child object is never set back to nil as I expected
it to be. This leaves me with an object that doesn’t have a backing
DB row. The object is, however, frozen and I can call “destroyed?” on
the object which returns true. Is this expected and defined
behavior? I couldn’t find this referenced anywhere as it seems that
the docs indicate the object would be set back to nil.
I’m simply resetting the object to nil if it has been destroyed after
I save the record, so this isn’t a problem, just not something I
expected. Maybe the docs should be updated?
Some background info: I’m using rails 2.3.5 running on jruby-1.3.1.
This is a has_one relationship and :allow_destroy is set to true in
the parent model.
Documentation I was looking at: