Search code examples
ruby-on-railsacts-as-taggable-on

Rails dependent: :destroy on acts-as-taggable-on


Ihave a Rails 5 app and I would like to destroy tags when the parent record is destroyed. I am trying to do something like:

class Job < ApplicationRecord
    acts_as_taggable_on :jobs, dependent: :destroy
    ...

When I do this I get the error:

undefined method `to_sym' for {:dependent=>:destroy}:Hash Did you mean? to_s to_set

The documentation for acts-as-taggable-on does not explicitly say you can use dependent: :destroy, but this issue makes me think you can.


Solution

  • I found that doing ActsAsTaggableOn::Tag.destroy_all removes all tags for me.