ash v0.3.0 Ash.Resource.Actions View Source
DSL components for declaring resource actions.
All manipulation of data through the underlying data layer happens through actions.
There are four types of action: create
, read
, update
, and destroy
. You may
recognize these from the acronym CRUD
. You can have multiple actions of the same
type, as long as they have different names. This is the primary mechanism for customizing
your resources to conform to your business logic. It is normal and expected to have
multiple actions of each type in a large application.
If you have multiple actions of the same type, one of them must be designated as the
primary action for that type, via: primary?: true
. This tells the ash what to do
if an action of that type is requested, but no specific action name is given.
Link to this section Summary
Functions
Declares a create
action. For calling this action, see the Ash.Api
documentation.
Declares an destroy
action. For calling this action, see the Ash.Api
documentation.
Declares a read
action. For calling this action, see the Ash.Api
documentation.
Declares an update
action. For calling this action, see the Ash.Api
documentation.
Link to this section Functions
Declares a create
action. For calling this action, see the Ash.Api
documentation.
:primary?
- Whether or not this action should be used when no action is specified by the caller. The default value isfalse
.
Examples
create :register, primary?: true
Declares an destroy
action. For calling this action, see the Ash.Api
documentation.
:primary?
- Whether or not this action should be used when no action is specified by the caller. The default value isfalse
.
Examples
destroy :soft_delete, primary?: true
Declares a read
action. For calling this action, see the Ash.Api
documentation.
:primary?
- Whether or not this action should be used when no action is specified by the caller. The default value isfalse
.
Examples
read :read_all, primary?: true
Declares an update
action. For calling this action, see the Ash.Api
documentation.
:primary?
- Whether or not this action should be used when no action is specified by the caller. The default value isfalse
.
Examples
update :flag_for_review, primary?: true