On 8 Apr 2008, at 16:14, Christoph Thommen wrote:
>
> Hi all
>
> I''ve got a message table, where the sender and the receiver are
stored
> (sender_user_id, receiver_user_id)
>
> How must i declare this dependencies in the user and message model?
>
> I''ve got the following one:
> has_many :messages, :foreign_key=>
> ''receiver_user_id''
>
> but how to declare the secound one?
>
I would probably do
has_many :received_messages, :class_name => "Message", :foreign_key
=>
''receiver_user_id''
has_many :sent_messages, :class_name => "Message", :foreign_key
=>
''sender_user_id''
Fred> Thank you for your help!
>
> Greets
> --
> 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
-~----------~----~----~----~------~----~------~--~---