jasono
jasono
AEAsh Elixir
Created by jasono on 9/4/2023 in #support
How to make 'actor' available in nested forms' action
I have Ash.set_actor(current_user) in the mount function of a liveview that contains a nested form. The create/update actions of the main (posts) and sub form (comments), both of which includes change fn changeset, %{actor: actor}, the variable actor passes the proper user map for post , but nil for comment`. Also tried passing actor like below, but it didn't help either. Is there anything else I need to do to make it available in the nested forms' action as well?
AshPhoenix.Form.for_update(post, :update,
api: MyPosts,
actor: socket.assigns.current_user,
forms: [

comments: [
resource: Comment,
data: [%Comment{}],
create_action: :create,
update_action: :update,
type: :list
],
AshPhoenix.Form.for_update(post, :update,
api: MyPosts,
actor: socket.assigns.current_user,
forms: [

comments: [
resource: Comment,
data: [%Comment{}],
create_action: :create,
update_action: :update,
type: :list
],
11 replies