Sha256: fdb0989f6f96c4732c74bcbdf55d8f0c7a60c78d6b51c0a93565e68a2f6b9495

Contents?: true

Size: 235 Bytes

Versions: 3

Compression:

Stored size: 235 Bytes

Contents

module Storytime
  class Tagging < ActiveRecord::Base
    belongs_to :tag
    belongs_to :post

    after_destroy :remove_unused_tags

  private
    def remove_unused_tags
      tag.destroy if tag.taggings.count == 0
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storytime-0.0.4 app/models/storytime/tagging.rb
storytime-0.0.2 app/models/storytime/tagging.rb
storytime-0.0.1 app/models/storytime/tagging.rb