From bb886748567fded369c68a09755a0cd8e1565e65 Mon Sep 17 00:00:00 2001 From: Katrina Owen Date: Tue, 19 Feb 2013 07:54:09 -0700 Subject: [PATCH] Rename callback for clarity --- app/models/tagging.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/tagging.rb b/app/models/tagging.rb index 7cc321a0..c067b31e 100644 --- a/app/models/tagging.rb +++ b/app/models/tagging.rb @@ -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 Tag 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