What association do I need?

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 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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs