mbleigh/acts-as-taggable-on — Issue #207: acts-as-taggable-on don't clear taggins when used `tag_list=nil`
Author: petRUShka
Created: 2011-12-05 17:41:44+00:00
State: open

I'm using acts-as-taggable-on. I have Article model:

class Article < ActiveRecord::Base
acts_as_taggable_on :tags
named_scope :without_tags, :joins => %Q{LEFT JOIN taggings ON taggings.taggable_id=articles.id AND taggings.taggable_type='Article'} , :conditions => 'taggings.id IS NULL'
end

I use following code to find all Articles without any tags:

Article.
joins(%Q{LEFT JOIN taggings ON taggings.taggable_id=articles.id AND taggings.taggable_type='Article'}).
where('taggings.id IS NULL')

I want to clear tags on some article. If I use following code

it "should return requests without it systems" do
article_without = Article.make
article_with = Article.make :tag_list => "test"

article_with.tag_ids= nil
Article.without_tags.should == [article_without, article_with]
end

It is ok and work as expected. But when I use `tag_list=` instead of `tag_ids=` it fails:
it "should return requests without it systems" do
article_without = Article.make
article_with = Article.make :tag_list => "test"

article_with.tag_list= nil
Article.without_tags.should == [article_without, article_with]
end

I'm using Rails 2.3.10 and acts-as-taggable-on (2.1.1)