Forum: Ruby on Rails Using one model in multiple associations to another model

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Cayce B. (Guest)
on 2007-01-30 17:39
Looking for some guidance on how to accomplish the following...

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

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

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

Mick S. (Guest)
on 2007-01-30 17:54
This thread will show you how to create multiple foreign keys in your
Cayce B. (Guest)
on 2007-01-30 18:26
Mick S. wrote:
> This thread will show you how to create multiple foreign keys in your
> model:

Thanks a bunch.

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

Mick S. (Guest)
on 2007-01-30 18:29
da nada ;-)

This topic is locked and can not be replied to.