NoobOnRails

Ruby on Rails tips, tricks and hints for the aspiring rails hero.



Saturday, April 08, 2006

acts_as_taggable error I was getting


I had a this little app I've been working on in which I had implemented the acts_as_Taggable gem but with the all new, all shiny polymorphic goodness of Rails 1.1, I decided to make the jump to the less documented but cool-because-DHH-wrote-it-himself acts_as_Taggable plugin. After making the switch, I loaded up the console via..

ruby script\console


and tested it out and it seemed to be working ok. I then proceeded to follow Chad Fowler's Tagging article in his excellent Rails Recipes book which looked like it was going to work swell. And it did, until I tried to edit some existing tags. Try to do so threw the error,

undefined method `parse' for Tag:Class
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/
base.rb:1123:in
`method_missing'
#{RAILS_ROOT}/vendor/plugins/acts_as_taggable/lib/
acts_as_taggable.rb:42:in
`tag_with'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/abstract/
database_statements.rb:51:in
`transaction'
d:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:91:in
`transaction'
#{RAILS_ROOT}/vendor/plugins/acts_as_taggable/lib/
acts_as_taggable.rb:39:in
`tag_with'


After wondering why I was getting this error for a while and even looking through the soruce (being relatively new to RoR and Ruby, I didn't know enough to spot what the problem may be) but I did try taking out my Tag model since it wasn't mentioned in the Rails Recipe article and whaddaya know, that did the trick. So to reiterate, if you are getting the error

undefined method `parse' for Tag:Class


Remove your Tag.rb model, restart the web server and you should be good to go.

More on the plugin after I've tinkered with it for a while...