Set the URL to http://localhost:8080/api/acronyms/1/ and the method to DELETE. Send the request and you’ll get an error back because you can’t delete the acronym while it’s linked in a sibling relationship to a category:
Which isn’t true. There won’t be an error and the acronym will be deleted. Because we set the delete rule to .cascade earlier, as was pointed out correctly in the code explanation of page 162
5. Add a reference between the acronymID property on AcronymCategoryPivot and the id property on Acronym. This sets up the foreign key constraint. .cascade sets a cascade schema reference action when you delete the acronym. This means that the relationship is automatically removed instead of an error being thrown.
Additionally, on page 182 it says to open “CategoryTests.swift and uncomment all the code”. Since the chapter didn’t tell me to use the starter project I obviously don’t have those. Might make sense to either advise the user to start with the starter project, or explain how to get the two Tests.swift files into the project.
One more. In the PDF the introduction to Section IV appears on page 357 in between chapter 21 and chapter 22 instead of before chapter 23 as expected.
Apologies this is an error in the book. We changed the chapter at late notice to allow the iOS app to delete acronyms easily.
The reason why the delete works is because of the cascade rule for delete actions. This will allow the pivot to be deleted before deleting the acronym. If you don’t specify an onDelete action then the delete will fail.