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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---