Module: Plutonium::Definition::Wizards

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/plutonium/definition/wizards.rb

Overview

The wizard definition macro (§5.1) — sugar over the Action system, mirroring Actions. It registers a launching action for a wizard auto-mounted on the resource's own controller (see Resource::Controllers::WizardActions):

class CompanyDefinition < Plutonium::Resource::Definition
wizard :configure, ConfigureCompanyWizard                # anchored → record action (show + list)
wizard :configure, ConfigureCompanyWizard, collection_record_action: false  # show page only
wizard :onboard,   CompanyOnboardingWizard               # no anchor → resource action
end

Placement is dictated by the wizard, mirroring interactions: an anchored wizard is a record action (the anchor is the URL :id, resolved through the resource controller's scoped, policy-gated resource_record!); a non-anchored wizard is a resource (collection) action. It's not overridable — a flag that doesn't apply to the kind raises. The configurable surface is where a RECORD action shows: the show page (record_action:) and the list rows (collection_record_action:), both on by default. Bulk wizards are not supported (§5.1) — wizards are per-instance flows.

The macro keeps a per-definition registry (registered_wizards) the resource-mounted WizardActions concern reads to resolve the wizard class by the :wizard_name route segment, and synthesizes a launch action whose URL resolver targets the auto-mounted member (anchored) or collection routes.