# What association do I need?

**URL:** <https://www.ruby-forum.com/t/what-association-do-i-need/185180>\
**Category:** Rails\
**Created:** [March 15, 2010, 5:55pm UTC](https://www.ruby-forum.com/t/what-association-do-i-need/185180 "2010-03-15T17:55:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![things\_and\_stuff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@things\_and\_stuff](https://www.ruby-forum.com/u/things_and_stuff)\
**Post date:** [March 15, 2010, 5:55pm UTC](https://www.ruby-forum.com/t/what-association-do-i-need/185180/1 "2010-03-15T17:55:32Z")

</div>

Hi

I’m a little confused as to what kind of association I need for this  
structure

I have the models user, task and logs which all can have associations  
to some models which can be put under the loose heading of tests, the  
problem is that the test models have to be different models as they  
contain vastly different data and behaviour eg, a iq test, reaction  
test, personality test.

I thought that the best approach would be to use a polymorphic  
association so that I could do something like user.tests, task.tests,  
log.tests and also user.iq\_tests etc but I’m not sure how I go about  
this as all the examples I’ve seen so far deal with one record having  
a single association with multiple types of model like have a single  
comment model being able to be linked with Post User or Photo and I’m  
not sure how to go from that to what I need

I’ve also seen a plugin which appears to deal with the type of thing  
that I want here [http://github.com/fauna/has\_many\_polymorphs](http://github.com/fauna/has_many_polymorphs) but as I  
dont know enough about polymorphic associations I have no idea if this  
is needed for my particular scenario

Can anyone advise me on this?
