Managing Relationships - Cascading deletes for has_one relationships.
I'm trying to work through setting up relationships the Ash-way and here's roughly the structure I have:
* A Campaign
Has One Ship
Has One Stash
** Has Many Crew Members
I have set up my campaign resource like this:
3 Replies
I created a test to make sure I knew what I was doing (obvs I don't):
The error appears to be that when I delete the campaign it's not cascading the deletes to the
has_one
relationships. I followed the instructions on the documentation about deletion order and then on Ash.Resource.Change.CascadeDestroy
but I am still getting this test failure:
I feel like I missed something super obvious in the documentation.IIRC there are options to
cascade_destroy
that may help you there
you may need the before_action
option for exampleThanks @ZachDaniel , both suggestions resulted in the solution: add the option
after_action?: false
.