Polymorphic has_and_belongs_to_many association

Habtm is only good for simple relationships; you’ll want to use has_many :through, which I believe works just fine with polymorphism.