passing actor when using AshPhoenix.Form.submit
I've been reading the policy guide and docs and I've got them up and running for all my read actions, but when submitting a create or update using AshPhoenix.Form I'm not sure where exactly to provide the actor. Is there a different way this is meant to be done?
5 Replies
if you're calling AshPhoenix.Form.submit, it can be supplied as an API option, eg.
AshPhoenix.Form.submit(socket.assigns.form, api_opts: [actor: socket.assigns.current_user])
You can do it there, but the better place would be
Also thanks to @sevenseacat for rewriting the bulk of the policies guide to make it more accessible and understandable 🙇
Ooh I didn’t know that one
Got it! So the actor is given to the form at creation and is already there for the submit. And yes, the policy guide is very thorough and readable, thank you @Rebecca Le 😊
Yep!