Forum: Ruby on Rails acts_as_taggable and single table inheritance

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Kevin O. (Guest)
on 2006-05-21 19:28
(Received via mailing list)
I've set up a couple of STI models like such that we get something like

class A < AR:Base

class B < A

class C < A

(using the acts_as_taggable plugin)

I can tag things just fine this way, the problem I encounter is that the
taggings are listed with the base class ("A") and not the appropriate
subclass ("B" or "C").  This is problematic because I need to be able to
generate a tag cloud by the appropriate 'class', and I don't want tags
from "B" mixing with those from "C".

Has anyone else encountered this problem before?

Wyatt Draggoo (Guest)
on 2006-05-30 09:18
(Received via mailing list)
On Sun, May 21, 2006 at 03:27:22PM -0000, Kevin O. wrote:
> acst_as_taggable
> _Kevin

This might be related to the problem I'm running into as well, and was
about to ask the list.

Model is similar to above:

class A < AR:Base

class B < A

class C < A

B.find_all acts as it should---only getting objects that belong to the
"B" class.

However, B.find_tagged_with('blah') returns all of the "A" class objects
tagged with 'blah', instead of only the "B" class objects.

Is there a work-around for this? Should a bug be filed somewhere?

I hate to add a conditional for Type = 'B' when working with the 'B'
class should constrain the results to the "B" objects.

Sean Treadway (Guest)
on 2006-05-30 14:25
(Received via mailing list)
Please try this patch:

This topic is locked and can not be replied to.