Code to allow only friends


#1

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.


#2

Santosh T. 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 D. With Rails:
http://pragprog.com/titles/rails3/

I hope that helps. Cheers,
-Nick