Creating a "friends" association?


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?



sorry, disregard my last message. Problems with google groups…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs