Hi, I''m trying to setup an application where users are interconnected. For example, each user will have multiple friends and each user can be friend of multiple people. Now, I just have one User table with fields ( id, name, information ). How do I use ActiveRecord in such a way that I get all friends of a perticular user by giving User.find(1).friends ? Thanks a lot, Pratik -- Posted via http://www.ruby-forum.com/.
This may be what you are after http://wiki.rubyonrails.com/rails/pages/HowToCreateASelfReferentialManyToManyRelationship -Peter
Thanks a lot Peter ! That what exactly what I was looking for :) Cheers, Pratik Peter Michaux wrote:> This may be what you are after > > http://wiki.rubyonrails.com/rails/pages/HowToCreateASelfReferentialManyToManyRelationship > > -Peter-- Posted via http://www.ruby-forum.com/.
Thanks a lot Peter ! That''s exactly what I was looking for :) Cheers, Pratik Peter Michaux wrote:> This may be what you are after > > http://wiki.rubyonrails.com/rails/pages/HowToCreateASelfReferentialManyToManyRelationship > > -Peter-- Posted via http://www.ruby-forum.com/.