vendredi 3 juillet 2015

How to make two foreign keys of same Model?

I've got a Model Message, that has message:text | date_sent:date as attributes. It should also have from_member and to_member representing the user that sent the message, and the user that received it.

How can I do that in Rails? I've read that the convention would be member_id for a ForeignKey to the model Member. But, what if I want two fields referencing Member?

Aucun commentaire:

Enregistrer un commentaire