diff --git a/lib/metasploit_data_models/active_record_models/tag.rb b/lib/metasploit_data_models/active_record_models/tag.rb
index <HASH>..<HASH> 100755
--- a/lib/metasploit_data_models/active_record_models/tag.rb
+++ b/lib/metasploit_data_models/active_record_models/tag.rb
@@ -11,9 +11,17 @@ module MetasploitDataModels::ActiveRecordModels::Tag
       }
       validates :desc, :length => {:maximum => 8191, :message => "desc must be less than 8k."}
 
+      before_destroy :cleanup_hosts
+
       def to_s
         name
       end
+
+      def cleanup_hosts
+        # Clean up association table records
+        Mdm::HostTag.delete_all("tag_id = #{self.id}")
+      end
+      
     }
   end
 end
Added before destroy method to remove hosts_tags associations upon tag
destroy.
[Bug #<I>]
FIXRM #<I>