Using one model in multiple associations to another model


#1

Looking for some guidance on how to accomplish the following…

Assume a ticket management system being developed, with a main Ticket
model.

A Ticket has:
a caller
an assigned resource
a closer
a last-updater
an escalation manager
one or more copy-to’s

All of these are just different people from my users table.

Any one person in the user table could be any one of these on one or
more tickets. That is, I could be the caller on one or more tickets, or
the assigned resource or the copy-to.

The same person could be one or more of these on any one ticket. That
is, I could be both the assigned resource and the closer on a particular
ticket.

I’m not sure how to do this within Rails, without creating multiple
tables and/or views. It’s not really polymorphic, as I understand it.
It’s not really STI, as I that. It’s kind of a hybrid. Can it be done
just by setting up the right associations with appropriate parms (like
:source, :foreign_key, :class_name)?

Just need to be set in the right direction and given a good push…

Thanks.
c.


#2

This thread will show you how to create multiple foreign keys in your
model:

http://www.ruby-forum.com/topic/95943


#3

Mick S. wrote:

This thread will show you how to create multiple foreign keys in your
model:

http://www.ruby-forum.com/topic/95943

Thanks a bunch.

And, um … wow, sorry - you’d think I would have seen that post this
am.

cb.


#4

da nada :wink:

Mick