Created
May 12, 2011 14:48
-
-
Save jlebrech/968648 to your computer and use it in GitHub Desktop.
friendships
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@friends_out = Friendship.where(:user_id=>current_user.id) #users "i" want to be friends with | |
@friends_in = Friendship.where(:friend_id=>current_user.id) #users who want to be friend with "me" | |
# users who haven't added "my" id to Friendship and vice versa | |
# user who are my friend and i'm their friends. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the UsersUser model you have there is similar to the Friendship model in
http://railscasts.com/episodes/163-self-referential-association
You way adds a status, so you just need to accept those who have added you.
I understand what you are doing now with status, is saves the cross referencial query.
thanks.