-
Notifications
You must be signed in to change notification settings - Fork 329
Destroy Action Flow
Sergio Cambra edited this page Jul 2, 2024
·
3 revisions
These methods are called in the following order:
-
delete_authorized_filter
called as before_action-
delete_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
-
process_action_linnk_action
-
get_row
which usesfind_if_allowed
to 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_main
which 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_list
if record was deleted, andrefresh_list
is enabled inconfig.delete
. - It will render
destroy.js.erb
view
- 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.