picks - A place to share your picks and discover others'
One well known difference between destroy_all
and delete_all
is
destroy_all
will trigger callbacks while delete_all
will not.
For has_many
, destroy
and destroy_all
will always call the destroy method of the record(s) being removed so that callbacks are run.
However delete
and delete_all
will either do the deletion according to the strategy specified by the :dependent
option, or if no :dependent
option is given, then it will follow the default strategy. The default strategy is :nullify
(set the foreign keys to nil), except for has_many :through
, where the default strategy is delete_all
(delete the join records, without running their callbacks).
solaris seems shiny! http://foodfightshow.org/2013/04/a-smarter-os.html