I'm not very clean about virtual attribute in Ecto model, Is it only mapped to the query result?
See at documentation:
:virtual
- When true, the field is not persisted to the database.
Virtual fields exists temporary in the Schema and were not saved in the database. This is helpful for local processes and validations.
Example: An password confirmation field.
schema "users" do
field :username, :string
field :password, :string
field :password_confirmation, :string, virtual: true
timestamps
end
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With