Skip to content

Commit

Permalink
fix: pass tenant to load in cascade destroy (#1775)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasJ authored Feb 7, 2025
1 parent 219771a commit f19a562
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ash/resource/change/cascade_destroy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ defmodule Ash.Resource.Change.CascadeDestroy do

defp destroy_related([], _, _, _), do: :ok

defp destroy_related(data, opts, context, changeset) do
defp destroy_related(data, opts, %{tenant: tenant} = context, changeset) do
action = opts.action
relationship = opts.relationship

Expand Down Expand Up @@ -307,7 +307,8 @@ defmodule Ash.Resource.Change.CascadeDestroy do
{relationship.name,
Ash.Query.set_context(relationship.destination, %{cascade_destroy: true})}
],
authorize?: false
authorize?: false,
tenant: tenant
)
|> Enum.flat_map(fn record ->
record
Expand Down

0 comments on commit f19a562

Please sign in to comment.