class_table_inheritance with acts_as_taggable
If I have:
The problem is that:
returns all the Products tagged with ‘test’ rather than all Subproducts. So I tried:
but that does the same thing. The problem boils down to the find_tagged_with! method using acts_as_taggable_options[:taggable_type] which is defined as class_name_of_active_record_descendant elsewhere in the acts_as_taggable plugin. The solution is to rewrite find_tagged_with! to :
This should work even for classes that aren’t using class table inheritance since it’ll just use the class name.
Refs: http://wiki.rubyonrails.org/rails/pages/ActsAsTaggablePluginHowto
