Sha256: 5e7e81bca21967b896d93c85c88e04f66410eb9f2e555af005cbe5db0a70690a

Contents?: true

Size: 359 Bytes

Versions: 2

Compression:

Stored size: 359 Bytes

Contents

module YeshuaCrm
  module ActsAsTaggable #:nodoc:
    class Tagging < ActiveRecord::Base #:nodoc:
      belongs_to :tag
      belongs_to :taggable, :polymorphic => true

      after_destroy :destroy_tag_if_unused

      private

      def destroy_tag_if_unused
        tag.destroy if Tag.destroy_unused && tag.taggings.count.zero?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yeshua_crm-1.0.1 lib/yeshua_crm/acts_as_taggable/tagging.rb
yeshua_crm-1.0.0 lib/yeshua_crm/acts_as_taggable/tagging.rb