Forum: Ruby on Rails Active record confusion

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-01-14 23:52
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
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 Peter Michaux (Guest)
on 2006-01-15 00:01
(Received via mailing list)
This may be what you are after

http://wiki.rubyonrails.com/rails/pages/HowToCreat...

-Peter
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-01-15 00:33
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/HowToCreat...
>
> -Peter
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-01-15 00:34
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/HowToCreat...
>
> -Peter
This topic is locked and can not be replied to.