Sha256: f4a193c49fd658fc2b9a4c48b139d7282d51c65fcb3417f09abce129f5082a1d

Contents?: true

Size: 359 Bytes

Versions: 4

Compression:

Stored size: 359 Bytes

Contents

module Redmineup
  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

4 entries across 4 versions & 1 rubygems

Version Path
redmineup-1.0.5 lib/redmineup/acts_as_taggable/tagging.rb
redmineup-1.0.4 lib/redmineup/acts_as_taggable/tagging.rb
redmineup-1.0.3 lib/redmineup/acts_as_taggable/tagging.rb
redmineup-1.0.2 lib/redmineup/acts_as_taggable/tagging.rb