active-record icon indicating copy to clipboard operation
active-record copied to clipboard

ActiveRecord unlink() not applying events/behaviors on junction model - inconsistent with link()

Open vercotux opened this issue 7 years ago • 2 comments

When declaring a 'via' (not 'viaTable') relation the respsective behaviors of link() vs unlink() are a bit inconsistent. link() will trigger events and use behaviors on the junction model provided by the 'via' modelClass while unlink() will not.

I think it is really awesome that link() uses insert() on the junction model, but conversely unlink() should also use delete() on the junction model.

vercotux avatar Jul 28 '17 02:07 vercotux

As I suspect this would break BC, maybe this should be moved to 3.x instead

machour avatar Jan 14 '19 22:01 machour

Moved.

samdark avatar Jan 14 '19 23:01 samdark