Rails 依赖::destroy on acts-as-taggable-on

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

我有一个 Rails 5 应用程序,我想在销毁父记录时销毁标签。我正在尝试做类似的事情:

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

执行此操作时出现错误:

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

documentation for acts-as-taggable-on does not explicitly say you can use dependent: :destroy, but this issue 让我觉得你可以。

我发现 ActsAsTaggableOn::Tag.destroy_all 会为我删除所有标签。