Here’s the my example.
I’m working with structure where a Room has_one Contract, and I want to enforce that a contract can only be created when the room is unsold. However, when using Ash.can?({Contract, :create}, actor)
, I can’t access the parent room’s state. So, I thought it would be necessary to verify the policy through Ash.can?({Room, :contract}, actor)
. For this reason, I’ve adjusted the Room’s contract action to take :contract_params
in a map. This adjustment has led me to wrap my form inputs with inputs_for
.
I’m not entirely happy with this solution and am unsure if there’s a better method. I would like to hear your thoughts or any alternatives.