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.
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-05-21 17: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?

C722d1f4590866f2344a683da3160b49?d=identicon&s=25 Wyatt Draggoo (Guest)
on 2006-05-30 07:18
(Received via mailing list)
On Sun, May 21, 2006 at 03:27:22PM -0000, Kevin Olbrich 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.

76f86ac45dfa10cc7dc586ea31f3dcb0?d=identicon&s=25 Sean Treadway (Guest)
on 2006-05-30 12:25
(Received via mailing list)
Please try this patch:

This topic is locked and can not be replied to.