I know that if I name a column in a table “othertablename_id” rails will know to use that column for a belongs_to or other relation. If I want to have multiple id’s from the same table, obviously this won’t work, because I would have duplicate column names. What is the best way to build a table that relates two rows from the same table? As in an Appointment table that relates exactly two Users.
Share
Ah I’ve got it
will use columns user_1_id and user_2_id respectively. The columns should be named something more descriptive of course, but it is quite simple.