<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -11,7 +11,6 @@ module ActiveRecord
         end
         
         def acts_as_taggable_on(*args)
-          puts &quot;Registering #{args.inspect} with #{self.inspect}&quot;
           for tag_type in args
             tag_type = tag_type.to_s
             self.class_eval do
@@ -53,11 +52,10 @@ module ActiveRecord
           end      
           
           if respond_to?(:tag_types)
-            puts &quot;Appending #{args.inspect} onto #{tag_types.inspect}&quot;
-            write_inheritable_attribute(:tag_types, tag_types + args)
+            write_inheritable_attribute( :tag_types, (tag_types + args).uniq )
           else
             self.class_eval do
-              write_inheritable_attribute(:tag_types, args)
+              write_inheritable_attribute(:tag_types, args.uniq)
               class_inheritable_reader :tag_types
             
               has_many :taggings, :as =&gt; :taggable, :dependent =&gt; :destroy, :include =&gt; :tag</diff>
      <filename>lib/acts_as_taggable_on/acts_as_taggable_on.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,9 @@
 require File.dirname(__FILE__) + '/../spec_helper'
 
-describe &quot;acts_as_taggable_on&quot; do
+describe &quot;Acts As Taggable On&quot; do
   context &quot;Taggable Method Generation&quot; do
     before(:each) do
+      [TaggableModel, Tag, Tagging, TaggableUser].each(&amp;:delete_all)
       @taggable = TaggableModel.new(:name =&gt; &quot;Bob Jones&quot;)
     end
   
@@ -33,7 +34,7 @@ describe &quot;acts_as_taggable_on&quot; do
     end
   end
   
-  context &quot;inheritance&quot; do
+  describe &quot;Single Table Inheritance&quot; do
     before do
       @taggable = TaggableModel.new(:name =&gt; &quot;taggable&quot;)
       @inherited_same = InheritingTaggableModel.new(:name =&gt; &quot;inherited same&quot;)
@@ -50,7 +51,7 @@ describe &quot;acts_as_taggable_on&quot; do
     end
   end
   
-  context &quot;reloading&quot; do
+  describe &quot;Reloading&quot; do
     it &quot;should save a model instantiated by Model.find&quot; do
       taggable = TaggableModel.create!(:name =&gt; &quot;Taggable&quot;)
       found_taggable = TaggableModel.find(taggable.id)
@@ -58,7 +59,7 @@ describe &quot;acts_as_taggable_on&quot; do
     end
   end
   
-  context &quot;related&quot; do
+  describe &quot;Related Objects&quot; do
     it &quot;should find related objects based on tag names on context&quot; do
       taggable1 = TaggableModel.create!(:name =&gt; &quot;Taggable 1&quot;)
       taggable2 = TaggableModel.create!(:name =&gt; &quot;Taggable 2&quot;)
@@ -77,4 +78,28 @@ describe &quot;acts_as_taggable_on&quot; do
       taggable1.find_related_tags.should_not include(taggable2)
     end
   end
+  
+  describe 'Tagging Contexts' do
+    context '#acts_as_taggable_on' do
+      before(:all) do
+        class Array
+          def freq
+            k=Hash.new(0)
+            self.each {|e| k[e]+=1}
+            k
+          end
+        end
+      end
+      
+      it 'should eliminate duplicate tagging contexts ' do
+        TaggableModel.acts_as_taggable_on(:skills, :skills)
+        TaggableModel.tag_types.freq[:skills].should_not == 3
+
+      end
+      after(:all) do
+        class Array; remove_method :freq; end
+      end
+    end
+  end
+  
 end
\ No newline at end of file</diff>
      <filename>spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
 
 describe &quot;Taggable&quot; do
   before(:each) do
+    [TaggableModel, Tag, Tagging, TaggableUser].each(&amp;:delete_all)
     @taggable = TaggableModel.new(:name =&gt; &quot;Bob Jones&quot;)
   end
   
@@ -96,8 +97,9 @@ describe &quot;Taggable&quot; do
     TaggableModel.find_tagged_with(&quot;spinning&quot;, :on =&gt; :rotors).should_not be_empty
   end
   
-  context &quot;inheritance&quot; do
+  describe &quot;Single Table Inheritance&quot; do
     before do
+      [TaggableModel, Tag, Tagging, TaggableUser].each(&amp;:delete_all)
       @taggable = TaggableModel.new(:name =&gt; &quot;taggable&quot;)
       @inherited_same = InheritingTaggableModel.new(:name =&gt; &quot;inherited same&quot;)
       @inherited_different = AlteredInheritingTaggableModel.new(:name =&gt; &quot;inherited different&quot;)</diff>
      <filename>spec/acts_as_taggable_on/taggable_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
 
 describe &quot;Tagger&quot; do
   before(:each) do
+    [TaggableModel, Tag, Tagging, TaggableUser].each(&amp;:delete_all)
     @user = TaggableUser.new
     @taggable = TaggableModel.new(:name =&gt; &quot;Bob Jones&quot;)
   end</diff>
      <filename>spec/acts_as_taggable_on/tagger_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,19 @@
 ActiveRecord::Schema.define :version =&gt; 0 do
-  create_table :tags, :force =&gt; true do |t|
-    t.column :name, :string
+  create_table &quot;taggings&quot;, :force =&gt; true do |t|
+    t.integer  &quot;tag_id&quot;,        :limit =&gt; 11
+    t.integer  &quot;taggable_id&quot;,   :limit =&gt; 11
+    t.string   &quot;taggable_type&quot;
+    t.string   &quot;context&quot;
+    t.datetime &quot;created_at&quot;
+    t.integer  &quot;tagger_id&quot;,     :limit =&gt; 11
+    t.string   &quot;tagger_type&quot;
   end
-  
-  create_table :taggings, :force =&gt; true do |t|
-    t.column :tag_id, :integer
-    t.column :taggable_id, :integer
-    t.column :taggable_type, :string
-    t.column :context, :string
-    t.column :created_at, :datetime
-    t.column :tagger_id, :integer
-    t.column :tagger_type, :string
+
+  add_index &quot;taggings&quot;, [&quot;tag_id&quot;], :name =&gt; &quot;index_taggings_on_tag_id&quot;
+  add_index &quot;taggings&quot;, [&quot;taggable_id&quot;, &quot;taggable_type&quot;, &quot;context&quot;], :name =&gt; &quot;index_taggings_on_taggable_id_and_taggable_type_and_context&quot;
+
+  create_table &quot;tags&quot;, :force =&gt; true do |t|
+    t.string &quot;name&quot;
   end
   
   create_table :taggable_models, :force =&gt; true do |t|</diff>
      <filename>spec/schema.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8113f9a98747fee8c6d14eb788508ebf6bd1d5ea</id>
    </parent>
  </parents>
  <author>
    <name>Michael Bleigh</name>
    <email>michael@intridea.com</email>
  </author>
  <url>http://github.com/mbleigh/acts-as-taggable-on/commit/3723036492fb0f054486c73bbbf2167ee43c2c5c</url>
  <id>3723036492fb0f054486c73bbbf2167ee43c2c5c</id>
  <committed-date>2008-06-11T11:41:34-07:00</committed-date>
  <authored-date>2008-06-11T11:41:34-07:00</authored-date>
  <message>Applied Sinclair Bain's patch to disallow duplicate contexts. Also cleaned up the specs and dealt with some strange failures I've been getting intermittently. [#14 status:resolved]</message>
  <tree>60758ab0ecdf99c6dccad7542cd106e50ef22b01</tree>
  <committer>
    <name>Michael Bleigh</name>
    <email>michael@intridea.com</email>
  </committer>
</commit>
