Ash FrameworkAF
Ash Framework3y ago
4 replies
Jason

Deleting intermediary table record in a many_to_many relationship

In this example (https://hexdocs.pm/ash/2.6.18/managing-relationships.html) that Post and Tag have a many_to_many relationshp through PostTag, how do I make it so that the deletion of Post also deletes the record in PostTag , but not Tag?

In post.ex, I have this action

destroy :delete_post do
end


which issues this error.
** (Ash.Error.Invalid) Input Invalid
* Invalid value provided for id: would leave records behind.
nil


I tried adding manage_relationship with various type options to this but couldn't get it to do what I want.
Was this page helpful?