two columns reference to the same table

cfingerh
Wed, 25 Jul 2007 21:16:23 -0000

I have one table with the users (id, name, birthday) and another table
with messages from one user to another. The problem is, in the message
table I need to create a relationship for the sender and the receiver
like this:

messages => id , text, date, user_id_receiver, user_id_sender

¿ How do I have to name those columns (user_id_sender,
sender_user_id,...)?
¿What do I have to write in the model file  message.rb for linking
both tables?
I need to get the name of the sender and the receiver of the message
<%=message.user.name %>  ???

thanks


--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---