Skip to content

[How To] Dependent destroy of associated activity in Rails

Jonathan Knapp edited this page Jul 7, 2014 · 1 revision

Here's how to setup a dependent destroy relationship on a Model that uses the trackable association. If you have a namespaced app you'll need the to specify the class_name.

has_many :activities, as: :trackable, class_name: 'PublicActivity::Activity', dependent: :destroy