Merge pull request #152 from kytrinyx/after-destroy-destroy

Rename callback for clarity
This commit is contained in:
Matt Rogers 2013-02-19 07:15:07 -08:00
commit 01b7f78f3c

View file

@ -8,12 +8,11 @@ class Tagging < ActiveRecord::Base
belongs_to :tag
belongs_to :taggable, :polymorphic => true, :touch => true
after_destroy :after_destroy
after_destroy :delete_orphaned_tag
private
# This callback makes sure that an orphaned <tt>Tag</tt> is deleted if it no longer tags anything.
def after_destroy
def delete_orphaned_tag
tag.destroy if tag and tag.taggings.count == 0
end