Rails 5.2 Association callbacks not firing on before_add or before_remove
问题 I have an Activity model with HABTM: has_and_belongs_to_many :contacts, -> { distinct }, before_add: :contact_calculate_score, before_remove: :contact_calculate_score def contact_calculate_score(contact) binding.pry contact.calculate_score end There are quite a few questions on this, for example this one. I have tried using '<<' to insert activities into contacts, but still the callback does not fire. Why is it not being called? As far as I can see, it is not the issue described in this