Virtual field in Ash attribute
What's the Ash way to handle virtual fields often used for inputs that are not persisted?
7 Replies
Generally, you will want to use
arguments
on the action itself.Ash HQ
DSL Section: ash > Resource > actions
View the documentation for DSL Section: ash > Resource > actions on Ash HQ.
So in this password string -> hash password example, how is the password included in the changeset as an attribute to show on a form?
The changeset will include both attributes (controlled by
accept [:attr, ...]
, defaulting to all public, writeable attributes) and arguments. You will want to use AshPhoenix.Form
to mange it, as Ash changesets are different than Ecto changesets. https://ash-hq.org/docs/module/ash_phoenix/latest/ashphoenix-formOkay. so both password and hashed password are attributes with no distinction of virtual : true or false. Got it. Thank you!!
For
Ash
, attribute
s are persisted in the data layer, whereas argument
s are ephemeral, only existing in the changeset.Okay. I will read the doc more about arguments. thanks.