Source section — action mapping, preloading, actor resolution, and per-mode access control.
Tells the form which Ash actions to call for each mode (create,
update, read), what relationships to preload for master vs. tenant
users, and who counts as a master user. Mirrors the table-side
source section.
Example
source do
actor_key :current_user
master_check fn user -> user && user.role == :admin end
actions do
create {:master_create, :create}
update {:master_update, :update}
read {:master_get, :read}
end
preload do
always [:user]
master [:comments, master_category: :category]
tenant tenant_category: :category
end
endSub-sections and entities
actions—create/update/read. Atom (used for both master and tenant) or{master_action, tenant_action}tuple. The action used at runtime is selected bymaster_check.preload— three-tier (always/master/tenant). Each list accepts atoms or{source, alias}tuples. The relationship's read action must NOT havepagination required?: true— preloads do not pass pagination params andLimitRequiredwill be raised at runtime.access— entity gating individual modes by role. SeeMishkaGervaz.Form.Entities.Access.
Inheritance
actor_key, master_check, and actions can be set at the domain
level (see MishkaGervaz.Form.Dsl.DomainDefaults); resource-level
values override them.