Many to many polymorphic relationships...

I've been struggling to get a clear and straight-forward answer on
this one, I'm hoping this time I'll get it! :smiley: I definitely have a lot
to learn still with Rails, however I do understand the problem I'm
facing and would really appreciate additional help.

o I have a model called "Task".
o I have an abstract model called "Target".
o I would like to relate multiple instances of subclasses of Target to
o I am not using single table inheritance.
o I would like to query the polymorphic relationship to return a mixed
result set of subclasses of Target.
o I would like to query individual instances of subclasses of Target
to obtain tasks that they are in a relationship with.

So, I figure a polymorphic many to many relationship between Tasks and
subclasses of Targets is in order. In more detail, I will be able to
do things like this in the console (and of course elsewhere):