I have Messages and User models with corresponding tables.
The Messages table has such fields like user_from and user_to.
How can associate the models to be able to access sender and recipient users objects:
message.user_from.name
message.user_to.id
...
Thanks.
The full solution for my case is:
because user id was not primary key in User table.