Showing posts with label bug. Show all posts
Showing posts with label bug. Show all posts

Thursday, February 14, 2008

Ruby acts_as_taggable plugin bug fix for Rails 2.0.2

What?
I'm working on a small rails app and wanted tags, so I went ahead and installed the acts_as_taggable plugin. However, I had some problem with installation. First, I just ran

./script/plugin install acts_as_taggable

and followed setup procedures. However, I then got the following error when I called acts_as_taggable in my class

NameError: uninitialized constant Tag

I then found a post that directed me to the correct source for the tag:

./script/plugin install http://svn.rubyonrails.org/rails/plugins/legacy/acts_as_taggable/

However, running rails 2.0.2, the has_many API has changed, so I got the following error:

ArgumentError (The :dependent option expects either :destroy, :delete_all, or :nullify (true))

I traced the error down in the plugin to the file rails_root/vendor/plugins/acts_as_taggable/lib/acts_as_taggable.rb

The error is on line 18

has_many :taggings, :as => :taggable, :dependent => true

should be

has_many :taggings, :as => :taggable, :dependent => :destroy

Now it works!