Skip to main content

EditDsl

cm_edit

Create a form for the edit 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.
partialStringPartial path of the page.
redirect_toProc, nilLambda to redirect after update.
display_ifProcLambda to conditionally display the form.

Example — Editing page with redirect

cm_edit(display_name: 'Edit Post', page_title: "Edit Post", page_description: 'Enter all details to edit Post', redirect_to: ->(current_object) { "/pages/#{current_object.id}" }) do
cm_section 'Details' do
form_field :title, input_type: :string
form_field :body, input_type: :rich_text
end
end

Method Signature

cm_edit(display_name: 'Edit', page_title: nil, page_description: nil, partial: nil, redirect_to: nil, display_if: ->(_arg) { true })