Skip to content

Latest commit

 

History

History
17 lines (10 loc) · 925 Bytes

2013-12-18.md

File metadata and controls

17 lines (10 loc) · 925 Bytes

picks - A place to share your picks and discover others'

hemant

Difference between delete_all and destroy_all

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).

deepak

solaris seems shiny! http://foodfightshow.org/2013/04/a-smarter-os.html