Forum: Ruby on Rails Creating a "friends" association?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
22cff534e3e25802bf451fd61f0d0e5d?d=identicon&s=25 (Guest)
on 2007-04-25 22:20
(Received via mailing list)

I'm trying to make a friendships table that looks like this:

  create_table "friendships", :force => true do |t|
    t.column "sent_by_user_id",     :integer
    t.column "received_by_user_id", :integer
    t.column "status",              :boolean

Where there is 1 record for each friendship, and User.friends returns
all friendships through :sent_by user and :received_by user.

Creating a User.friends model method is no trouble, but I'd like to
make a :friends association to preserve the association magic.

Is there a way to write an association that will return both sets
sent_by and received_by?


22cff534e3e25802bf451fd61f0d0e5d?d=identicon&s=25 (Guest)
on 2007-04-25 22:21
(Received via mailing list)
sorry, disregard my last message.  Problems with google groups...
This topic is locked and can not be replied to.