Skip to main content

DestroyDsl

cm_destroy

Create a form for the destroy action.

Parameters

NameTypeDescription
display_nameStringThe display/button name of the page.
page_titleString | SymbolThe title of the page, symbol will use a model method.
page_descriptionStringDescription of the page.
confirmation_textStringConfirmation text to show in the modal.
partialStringPartial path of the page.
redirect_toProc, nilLambda to redirect after destroy.
display_ifProcLambda to conditionally display the form.

Example — Destroying page with redirect

cm_destroy(display_name: 'Delete Post', page_title: "Delete Post", page_description: 'Are you sure you want to delete this Post?', confirmation_text: 'Delete', redirect_to: ->(current_object) { "/pages" })

Method Signature

cm_destroy(display_name: 'Delete', page_title: nil, page_description: nil, partial: nil, redirect_to: nil, confirmation_text: 'Delete', display_if: ->(_arg) { true })