In rails guides it's described like this:
Objects will be in addition destroyed if they’re associated with:dependent => :destroy
, and deleted if they’re associated with:dependent => :delete_all
But what's the difference between being destroyed and being deleted?
The difference is with callback.
The :delete_all, made directly in your application the delete by SQL :
DELETE * FROM users where compagny_id = XXXX
With the :destroy, there are an instantiation of all of you children.
So, if you can't destroy it or if each has their own :dependent, its can be called.
No comments:
Post a Comment