DSL Reference
Every method you can call inside a cm_admin block, grouped by where it applies. Each method links to the page that documents it with examples.
cm_admin blockβ
Model-level settings, declared once per model. See Views and Configuration.
| Method | What it does |
|---|---|
actions | Enables or disables the built-in CRUD actions (only: / except:). |
icon_name | Sidebar icon for the model. See Views. |
display_name | Label shown in the sidebar and page headers. |
visible_on_sidebar | Hides the model from the sidebar while keeping its pages reachable. |
comments_tab | Adds a comments tab to the show page. See Comments & Mentions. |
policy_scopes | Narrows the records a role can see. See Roles & Permissions. |
default_scopes | Model scopes applied to every action. |
override_policy | Uses a custom Pundit policy. See Roles & Permissions. |
additional_permitted_fields | Extra params permitted on create/update beyond the declared form_fields. |
global_search_fields | Columns searched by global search. See Global search. |
mcp_actions | Exposes list/get/aggregate (and opt-in create/update) over MCP. See MCP server. |
importable | Enables CSV import. See Importers. |
description | Internal description of the model config. |
Pagesβ
Each method declares one admin page. See Views.
| Method | Page |
|---|---|
cm_index | Index page β table, card or kanban listing. |
cm_show | Show page β record detail with tabs. |
cm_new | New page β create form. |
cm_edit | Edit page β update form. |
cm_destroy | Destroy β delete confirmation. |
cm_dashboard | Dashboards β metric cards, charts and tables. |
Page layoutβ
Used inside a page block to structure its content. See Page header & layout, Tabs, Rows and Sections.
| Method | What it does |
|---|---|
page_title | Title shown at the top of the page. |
page_description | Text (HTML allowed) below the title. |
title_icon | Icon next to the page title, with optional link and tooltip. |
tab | A tab on a show page, including association tabs (has_many / has_one). See Tabs. |
row | Lays sections out in a row (for side-by-side content). See Rows. |
cm_section | A titled section holding fields. See Sections. |
cm_show_section | Deprecated alias of cm_section. |
nested_form_section | A cm_section nested inside another section. See Sections. |
step | A step inside a form or progressive form. See Progressive forms. |
alert_box | A callout box on the page. See Alerts. |
Listing optionsβ
Used inside cm_index. See Index page.
| Method | What it does |
|---|---|
column | A table column. See Columns. |
all_db_columns | Adds a column for every database column. |
filter | A filter (search, select, range, date). See Filters. |
sort | A sortable column. See Sorting. |
scope_list | Model scopes applied to this listing only. |
kanban_view | Renders the listing as a kanban board grouped by a column. |
eager_load_associations | Associations to preload to avoid N+1 queries. |
Fieldsβ
Used inside cm_section, tab, step and forms. See Fields and Form fields.
| Method | What it does |
|---|---|
field | Renders an attribute on a show page. See Show fields. |
form_field | Renders a form input. See Form fields. |
nested_form_field | Edits or lists a has_many association inline. See Nested form fields. |
Actionsβ
Used inside a page block or the cm_admin block. See Actions.
| Method | What it does |
|---|---|
custom_action | A button, modal, form or page action. See Custom actions. |
bulk_action | An action run on selected records. See Bulk actions. |
action_group | Groups actions under one dropdown. See Group actions. |
Relatedβ
- Generators β every
cm_admin:*generator - Configuration β global
CmAdmin.configureoptions