Forum: Ruby on Rails code to allow only friends.

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.
F7771106c97ecf3fab4c35d70290c2c1?d=identicon&s=25 Santosh Turamari (santoshturamari)
on 2008-11-10 08:08
I have an app in which, I have profiles which has friends list.. I want
to apply some privacy settings as to allow, to visit only their friends
in network..How to write the code in controller.. can anybody pls
explain me.. I am new to ror.
49de4cd2f26705785cbef2b15a9df7aa?d=identicon&s=25 Nick Hoffman (nickh)
on 2008-11-11 17:24
Santosh Turamari wrote:
> I have an app in which, I have profiles which has friends list.. I want
> to apply some privacy settings as to allow, to visit only their friends
> in network..How to write the code in controller.. can anybody pls
> explain me.. I am new to ror.

That's just implementating constraints via relationships. Assuming that
you've created some type of "User" and "FriendsList" models, they
obviously have some sort of relationship. So in your controller actions,
simply access the friends list via the relationship.

If you don't know how to do that, I strongly recommend that you buy and
read the newest (beta) edition of Agile Web Development With Rails:
  http://pragprog.com/titles/rails3/

I hope that helps. Cheers,
-Nick
This topic is locked and can not be replied to.