Skip to content

Commit

Permalink
fix: pass tenant to Changeset.for_* directly (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayminlwin authored Dec 13, 2023
1 parent 2bf5c3a commit 6d4c7ee
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/ash_admin/components/resource/form.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1253,13 +1253,6 @@ defmodule AshAdmin.Components.Resource.Form do
changeset
|> set_table(socket.assigns[:table])
|> Map.put(:actor, socket.assigns[:actor])
|> case do
%Ash.Changeset{} ->
Ash.Changeset.set_tenant(changeset, socket.assigns[:tenant])

%Ash.Query{} ->
Ash.Query.set_tenant(changeset, socket.assigns[:tenant])
end
end

case AshPhoenix.Form.submit(form,
Expand Down Expand Up @@ -1613,7 +1606,8 @@ defmodule AshAdmin.Components.Resource.Form do
actor: socket.assigns[:actor],
authorize?: socket.assigns[:authorizing],
forms: auto_forms,
transform_errors: transform_errors
transform_errors: transform_errors,
tenant: socket.assigns[:tenant]
)

:update ->
Expand All @@ -1623,7 +1617,8 @@ defmodule AshAdmin.Components.Resource.Form do
forms: auto_forms,
actor: socket.assigns[:actor],
authorize?: socket.assigns[:authorizing],
transform_errors: transform_errors
transform_errors: transform_errors,
tenant: socket.assigns[:tenant]
)

:destroy ->
Expand All @@ -1633,7 +1628,8 @@ defmodule AshAdmin.Components.Resource.Form do
forms: auto_forms,
actor: socket.assigns[:actor],
authorize?: socket.assigns[:authorizing],
transform_errors: transform_errors
transform_errors: transform_errors,
tenant: socket.assigns[:tenant]
)
end

Expand Down

0 comments on commit 6d4c7ee

Please sign in to comment.