destroy unmatching related associations

I'm currently trying to destroy the associations in case the attribute is an empty list with this change
change manage_relationship(:owner_teams, :owner_teams,
type: :direct_control,
on_lookup: :ignore,
on_match: :ignore,
on_no_match: {:create, :upsert},
on_missing: :destroy
)
change manage_relationship(:owner_teams, :owner_teams,
type: :direct_control,
on_lookup: :ignore,
on_match: :ignore,
on_no_match: {:create, :upsert},
on_missing: :destroy
)
while the upsert part works just fine the destroy piece is not doing anything, and I yes I can confirm the attribute is an empty list.
Enum.map(teams_deduped, &to_owner_team/1) #=> []
Enum.map(teams_deduped, &to_owner_team/1) #=> []
Thank you
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?