acts_as_taggable with single-table inheritance?

Martin Longo wrote:

Does anyone have any experience making this work? I installed the
plugin and tried the following:

class SomeClass < ActiveRecord::Base
   acts_as_Taggable
end

class SubClass1 < SomeClass
end

class SubClass2 < SomeClass
end

SubClass1.tag_with("tag")

and notice that taggable_type = SomeClass

when I do SubClass2.find_tagged_with("tag") a SubClass1 object is
returned.

Any help would be greatly appreciated!

.Martin

--
Posted via http://www.ruby-forum.com/.

Yeah, it has issues. The STI mechanism will force the 'class' column
to be 'SomeClass' even if it is actually a subclass of that.

I had to do some nasty hackery to get around that. It involved adding
another column that stored the classname of the object. It's messy,
and untested, so I would be hesitant about sharing it.

You can get around this by doing this...

SubClass.find_tagged_with("tag").delete_if {|x| !x.kind_of? SubClass1 }

_Kevin