Relationship Conventions

Hi Team!

Just having a bit of trouble with the many-to-many relationship of the
same type.
Im trying to build a buddy list. So I have a users table and want to
allow each user to have a buddlist of users.

Ive tried having a User model and a Buddy model where the buddy model
has 2 fields user_id and a buddy_id but i cant get the buddy.name
methods to resolve when getting a list of buddies.

Anyone know the convention for this type of setup?

Thanks Guys,
Pat

Patrice wrote:

Just having a bit of trouble with the many-to-many relationship of the
same type.
Im trying to build a buddy list. So I have a users table and want to
allow each user to have a buddlist of users.

Ive tried having a User model and a Buddy model where the buddy model
has 2 fields user_id and a buddy_id but i cant get the buddy.name
methods to resolve when getting a list of buddies.

Anyone know the convention for this type of setup?

I had a similar scenario, and I found this tip was right on:
http://wiki.rubyonrails.org/rails/pages/HowToCreateASelfReferentialManyToManyRelationship

Hope it helps,
Tom

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