Destroy Action Flow - activescaffold/active_scaffold GitHub Wiki
Action 'destroy'
These methods are called in the following order:
delete_authorized_filter
called as before_actiondelete_authorized?
(or the method defined in conf.delete.link.security_method if it's changed) is called to check the permission. If this method returns false,delete_authorized_filter
will raise ActiveScaffold::ActionNotAllowed.
destroy
do_destroy
destroy_find_record
which usesfind_if_allowed
to load the record to be edited into @record instance variable, checking :delete permission.
respond_to_action
, which will call the corresponding response method for destroy action and the requested format.- For HTML request:
- It will call
return_to_main
which redirects tomain_path_to_return
, which defaults to list.
- It will call
- For XHR request:
- It will call
do_refresh_list
if record was deleted, andrefresh_list
is enabled inconfig.delete
. - It will render
destroy.js.erb
view
- It will call
- For HTML request:
destroy_find_record
can be overrided to change how record is find, or do_destroy
to change how the record is destroyed, for example enabling a flag to hide the record instead of deleting it.