Best way to implement friendship thing?

I am new to rails and have to develop a small app which will do regular
social networking.
So, whats the best and efficient way to implement friends/friendship
thing so that I could get complete list of every user’s friends with
@user.friends and also which is easy to maintain and implement.

Thanks.

Vapor … wrote:

I am new to rails and have to develop a small app which will do regular
social networking.
So, whats the best and efficient way to implement friends/friendship
thing so that I could get complete list of every user’s friends with
@user.friends and also which is easy to maintain and implement.

Thanks.

You’ll want to do a self referential ‘has_many :through =>’.

A google search with just the right keywords (eg: self referential
has_many through) should get you all the information you need, and then
some.

Good Luck! And welcome to Rails.


http://www.5valleys.com/
http://www.workingwithrails.com/person/8078

Hi Jon,

Take a look at this plugin.
http://www.railslodge.com/plugins/40-has-many-friends

Jon G. wrote:

Vapor … wrote:

I am new to rails and have to develop a small app which will do regular
social networking.
So, whats the best and efficient way to implement friends/friendship
thing so that I could get complete list of every user’s friends with
@user.friends and also which is easy to maintain and implement.

Scott A S wrote:

Hi Jon,

Take a look at this plugin.
http://www.railslodge.com/plugins/40-has-many-friends

actually I want to sort of understand it…I mean how it all actually
works with has_many => :through

Use the awesome plugin “has_many_friends”:
http://svn.dnite.org/has_many_friends/README

Check out RailsSpace book on Amazon:
http://www.amazon.com/RailsSpace-Building-Networking-Addison-Wesley-Professional/dp/0321480791/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1201892461&sr=1-1

The post I liked the most is:

http://www.fallenrogue.com/article/view/143-I-am-what-I-am-or-self-referential-joins-in-Rails

AWDWR and Rails Recipes also help a lot.

Cheers, Sazima

On Feb 1, 3:15 am, “Vapor …” [email protected]

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