Could not relate to actor, as no actor was found (and :allow_nil? is false
When I submit a form that triggers :create action which contains
change relate_actor(:author)
, I get this error. What causes no actor to be found despite that there is a logged in user?
4 Replies
Did you pass in the actor to the form?
No. 🙂 How do I do that?
You have two ways of setting who the current user is. The most explicit way is to pass it in when creating the form, same way its done w/ changesets
Form.for_create(...., actor: socket.assigns.current_user)
there is also the process context way, where you set it for everything that happens in the current process
Ash.set_actor(socket.assigns.current_user)
Got it. Thank you!