Sha256: 606e1c01f75022659cc8820a61ada1de5e3b062095d5e0b95c88bef9855e95dc

Contents?: true

Size: 301 Bytes

Versions: 6

Compression:

Stored size: 301 Bytes

Contents

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
    if Tag.destroy_unused
      if tag.taggings.count.zero?
        tag.destroy
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
protolif-acts_as_taggable_on_steroids-2.1.2 app/models/tagging.rb
protolif-acts_as_taggable_on_steroids-2.1.1 app/models/tagging.rb
bborn-acts_as_taggable_on_steroids-2.1 app/models/tagging.rb
bborn-acts_as_taggable_on_steroids-2.0.beta3 lib/tagging.rb
bborn-acts_as_taggable_on_steroids-2.0.beta2 lib/tagging.rb
acts_as_taggable3-2.0.beta2 lib/tagging.rb