samedi 24 décembre 2016

Rails pattern for destroying relationship between two ActiveRecord objects

Say I have two models, A and B, where each has a has_and_belongs_to_many relationship with the other. That is, some A objects and B objects are "connected".

What would be the proper way to offer a route to destroy this relationship? It doesn't really make sense to be a destroy action on A or B's controller since we aren't destroying A or B. Is there some sort of standard way to do this?

Thanks :)

Aucun commentaire:

Enregistrer un commentaire