Cayce Balara
2007-Jan-30 15:39 UTC
Using one model in multiple associations to another model
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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mick Sharpe
2007-Jan-30 15:54 UTC
Re: Using one model in multiple associations to another mode
This thread will show you how to create multiple foreign keys in your model: http://www.ruby-forum.com/topic/95943 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Cayce Balara
2007-Jan-30 16:26 UTC
Re: Using one model in multiple associations to another mode
Mick Sharpe wrote:> This thread will show you how to create multiple foreign keys in your > model: > > http://www.ruby-forum.com/topic/95943Thanks a bunch. And, um ... wow, sorry - you''d think I would have seen that post this am. cb. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mick Sharpe
2007-Jan-30 16:29 UTC
Re: Using one model in multiple associations to another mode
da nada ;-) Mick -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---