Hi everyone,
A couple of weeks ago I noticed a bug with :dependent => :nullify on
a has_many or has_one. When you delete the parent, the children's
foreign keys are nullified, as expected. But when you do
parent.child.delete or parent.children.clear, ActiveRecord actually
deletes the child records, rather than just nullifying them.
In my eyes, if you've set :dependent => :nullify, you're saying that
the child records should only ever be nullified, not deleted. The
behaviour I'm seeing seems to be a hang over from when
setting :dependent always meant 'delete/destroy the children'.
However, I realise that maybe this is just my interpretation of what
the :dependent => :nullify option is supposed to do. So I'd be
interested to hear what everyone else thinks.
I've written up the problem, with a patch, here:
http://dev.rubyonrails.org/ticket/5209
Cheers,
Chris
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core