Behavior Reference
The behavior layer is intentionally thin:
- Controllers route — handle requests, redirect after submit, transform params.
- Policies authorize — decide who can do what, which fields they can see, which records they can access.
- Interactions present — declare the inputs for a custom operation (publish, archive, import, send invitation), render as a button and a form, and hand back an outcome.
- Async Interactions —
asyncdeclares a persisted, resumable run instead of executing inline, for bulk operations and anything else too slow to hold a request open.
Registering an action and rendering it lives in Resource › Definition and Resource › Actions. This section covers writing the controller hook, policy method, or interaction class behind it.
And the operation itself lives on the model
An interaction is a presentation object — it can only be constructed with a view_context. Logic may start in execute, but the second caller (a job, an API controller, a rake task, the console) is the trigger to move it onto the record, Rails-style. See Interactions › What an interaction is for.
For multi-tenant relation_scope and entity scoping, see Tenancy › Entity scoping.
At a glance
| Concern | Where it lives |
|---|---|
| Field rendering (inputs, displays, columns, search/filters) | Definition |
| Custom operations (publish, archive, import) | Interaction + Action on the definition |
| Work too slow or too large for a request | Async Interactions |
| Authorization rules | Policy |
Tenant scoping (relation_scope) | Policy + Tenancy |
| Custom redirect logic, param munging, custom index query shape | Controller hook |
| Presentation of parent/entity fields | Controller presentation hooks |
