Forum: Ruby on Rails two columns reference to the same table

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.
82fdd815fedbcd9cca7eb94644a0530b?d=identicon&s=25 cfingerh (Guest)
on 2007-07-25 23:24
(Received via mailing list)
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,
¿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
< %>  ???

This topic is locked and can not be replied to.