title: Acts As Taggable On
body: <p>I'm having problems getting the <a href="https://github.com/mbleigh/acts-as-taggable-on" rel="nofollow">acts-as-taggable-on gem</a> working properly.</p>
  
  <p>I have a model:</p>
  
  <pre><code>class Resource &lt; ActiveRecord::Base
    acts_as_taggable
  
  end
  </code></pre>
  
  <p>I can add tags to it, and though its <code>tag_list</code> is populated:</p>
  
  <pre><code>$ a = ArchiveResource.new()
  $ a.tag_list = ["one", "two", "three"]
  $ a.tag_list # ["one", "two", "three"]
  </code></pre>
  
  <p>However, its <code>tag</code> association is not:</p>
  
  <pre><code>$ a.tags # []
  </code></pre>
  
  <p>If I check for all the tags, I can see they are being created:</p>
  
  <pre><code>$ ActsAsTaggableOn::Tag.all #&lt;ActsAsTaggableOn::Tag id: 1, name: "one"&gt;,
                              #&lt;ActsAsTaggableOn::Tag id: 2, name: "two"&gt;,
                              #&lt;ActsAsTaggableOn::Tag id: 3, name: "three"&gt;
  </code></pre>
  
  <p>And if I check the model's <code>taggings</code> association I can see they exist there:</p>
  
  <pre><code>$ a.taggings #&lt;ActsAsTaggableOn::Tag id: 1, name: "one"&gt;,
               #&lt;ActsAsTaggableOn::Tag id: 2, name: "two"&gt;,
               #&lt;ActsAsTaggableOn::Tag id: 3, name: "three"&gt;
  </code></pre>
  
  <p>Looking more closely at a call to <code>a.tags.all</code> I can see from the query that there is a mismatch:</p>
  
  <pre><code>  ActsAsTaggableOn::Tag Load (0.9ms)  SELECT "tags".* FROM "tags" INNER JOIN "taggings" ON "tags"."id" = "taggings"."tag_id" WHERE "taggings"."taggable_id" = 1 AND "taggings"."taggable_type" = 'ArchiveResource' AND (taggings.context = ('tags'))
  </code></pre>
  
  <p>However the <code>taggings_context</code> of the model's Taggings are all set to <code>tag</code> <em>singular</em>, so the query always fails:</p>
  
  <pre><code>&lt;ActsAsTaggableOn::Tagging id: 1, tag_id: 1, taggable_id: 1, taggable_type: "Resource", tagger_id: nil, tagger_type: nil, context: "tag", created_at: "2013-09-10 17:12:20
  &lt;ActsAsTaggableOn::Tagging id: 2, tag_id: 1, taggable_id: 1, taggable_type: "Resource", tagger_id: nil, tagger_type: nil, context: "tag", created_at: "2013-09-10 17:12:20
  &lt;ActsAsTaggableOn::Tagging id: 3, tag_id: 1, taggable_id: 1, taggable_type: "Resource", tagger_id: nil, tagger_type: nil, context: "tag", created_at: "2013-09-10 17:12:20
  </code></pre>
  
  <p>If I run through all the Taggables and set context to <code>tags</code>, everything works:</p>
  
  <pre><code>ActsAsTaggableOn::Tagging.all.each{|t|t.context = "tags"; t.save!}
  </code></pre>
  
  <p><strong>So why is this happening. Is it a bug or am I doing something wrong?</strong></p>