From 1e430fd9aae6fd28566f90aeb9502a80f81b356a Mon Sep 17 00:00:00 2001 From: Guilherme Moretti Date: Fri, 7 Jan 2011 23:55:37 -0300 Subject: [PATCH] Added peding and requested methods to InstanceMethods --- lib/has_friends.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/has_friends.rb b/lib/has_friends.rb index 6179e07..f785487 100644 --- a/lib/has_friends.rb +++ b/lib/has_friends.rb @@ -61,6 +61,14 @@ def friendship_for(friend) friendships.first :conditions => {:friend_id => friend.id} end + def pending + self.friendships.find_all { |f| f.pending? } + end + + def requested + self.friendships.find_all { |f| f.requested? } + end + def is?(friend) self.id == friend.id end @@ -72,4 +80,4 @@ def destroy_all_friendships end end end -end \ No newline at end of file +end