Load data from id for a policy check during a create action
I have a create action that will create a new
Offer
Offer
, that offer needs to be related to a
Property
Property
, so one of the fields I accept as input is a
property_id
property_id
.
In my policies, I need to check some of this property fields, meaning that I need to load that property and make it accessible to that action policies somehow.
How can I do such a thing with Ash?
Also, can I make the whole process inside a transaction? Meaning that I have strong guarantees that what I'm checking in the policy is actually what is in the database at that time (avoiding race conditions).
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.