Two references to another table from one table

Florencio Cano wrote:

How I can have two references from one table to another table? I have a table invitations that have a user_id pointing to the person who invites and I want another user_id to point to the person invited. Should I forget the conventions in this case?

I would definitely forget the conventions and make the columns something like invited_by_id and invited_id. Then in your model: belongs_to :invited_by, :class_name => "User", :foreign_key => "invited_by_id" belongs_to :invited, :class_name => "User", :foreign_key => "invited_id"

@invitation.invited.name was invited by @invitation.invited_by.name

Dan Manges