I have a doubt, Im making a friend's platform on a Ruby on Rails site; I have a table called users, and a table called friends that manages the friendships between the users. In friends I have 2 fields, *user_id1* and *user_id2*. This is the relationship I made in the models:
class User < ActiveRecord::Base has_many :friends end
class Friend < ActiveRecord::Base belongs_to :user, :foreign_key => "user_id1" belongs_to :user, :foreign_key => "user_id2" end
Is this a good way to handle this situation? Another idea is create another model that points to the same table in the database, userAux, and use it for the relationship. What do you think is best? Do you have a better idea?
Thanks in advance.