Destroy Action Flow - activescaffold/active_scaffold GitHub Wiki
Action 'destroy'
These methods are called in the following order:
delete_authorized_filtercalled 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_filterwill raise ActiveScaffold::ActionNotAllowed.
destroyprocess_action_linnk_actionget_rowwhich usesfind_if_allowedto load the record to be edited into @record instance variable, checking :delete permission.do_destroy
respond_to_action, which will call the corresponding response method for destroy action and the requested format.- For HTML request, calls
destroy_respond_to_html- It will call
return_to_mainwhich redirects tomain_path_to_return, which defaults to list.
- It will call
- For XHR request, calls
destroy_respond_to_js- It will call
do_refresh_listif record was deleted, andrefresh_listis enabled inconfig.delete. - It will render
destroy.js.erbview
- It will call
- For HTML request, calls
do_destroy can be overrided to change how the record is destroyed, for example enabling a flag to hide the record instead of deleting it, destroy_respond_to_html or destroy_respond_to_js to change the response, or destroy.js.erb view to change or add some JS code to the response on XHR request.