I’d like to revisit a topic from several years ago about the behavior of deleting/updating associated attributes when updating a has_many or has_many :through relationship. There needs to be an option to replace the contents for the associated record with the params hash being sent to the server. It’s not always feasible to set the _destroy attribute, and doesn’t play nice with how frontend frameworks work when using Rails in API mode.
The way newer front end frameworks handle one-to-many and many-to-many forms is as follows. Angular 2+ allows you to create dynamic form inputs through the use of FormArray. When you add related form elements to a form, FormGroup items are pushed to the FormArray. When you edit a record, then remove an item, the FormGroup is removed from the array, and when submitted to the server through a PUT or PATCH request, the deleted records are not included in the hash. The HTTP request is an exact copy of what the data should look like in the database.
Of course it’s always possible to munge the request on the frontend or backend, but it would be nice if the front end could behave as necessary and Rails have the option to replace the entire record. I believe that it’s not the responsibility of the frontend to manipulate the behavior. Following is a discussion from 2009 that explains with a little more in depth of the issue, but keep in mind, Rails was being used in entirely different ways back then.