lpmay
AEAsh Elixir
•Created by lpmay on 7/18/2023 in #support
Confused about `one_of` vs `attribute_equals`
Still messing around and encountered a confusing behavior with validations. I have a
:verify
action on a resource, which I only want to run on resources which have :role
set to :unverified
The below works as expected (produces valid/invalid changesets as expected):
What confuses me is that the below version using one_of
instead of attribute_equals
seems to me like it should do the same thing, but it never seems to produce an invalid changeset:
Can someone point out what I am misunderstanding?36 replies
AEAsh Elixir
•Created by lpmay on 7/17/2023 in #support
Can You Add Additional Attributes to ash_authentication_phoenix?
I went through the tutorial for and have password/email auth working. I'd like to add a
role
attribute to my user resource so I did the below:
At runtime, the form seems to have errors like this:
Is the intent that I can have arbitrary attributes on a user resources used with Ash Authentication
like this, or is there another approach I should be looking into? Ultimately, I'd like to add some code to seeds.exs
which creates a couple :admin
accounts and gate certain features behind only that role, but I'm very new to Ash, Phoenix and Elixir so I'm not sure if I'm heading in the right general direction or not.6 replies