Displaying 2 results from an estimated 2 matches for "friend_of".
Did you mean:
friends_of
2009 Feb 02
2
ActiveRecord::AssociationTypeMismatch (User(#54754560) expected, got User(#54510280))
...t; ActiveRecord::Base
include FriendInvitationUser, FriendshipUser
...
end
# friendship.rb
...
module FriendshipUser
def self.included(includer)
includer.class_eval do
has_many :friends, :through => :friendship
end
end
# true, if other_user is a friend of mine
def friend_of?(other_user)
Friendship.between?(self, other_user)
end
...
end
so basically I''m using modules to mixin new aspects into the User
model (kinda like AOP in ruby). i believe that these mixins together
with the require statements at the top of the User model file cause
the Associati...
2006 Jan 27
2
User.already_friend_of(friend)?
I have a User model who HBTM Friends (class User). I would like to check
for the existance of a user in the friends table before actually adding
them (in case they were already added as a friend.)
I have a method called already_friend_of?(friend) defined in my User
model, but I am not sure how to define this method. I simply want to
check to see if one user is already a friend of another user (I also use
this method in my views to change the state of some links and buttons -
for example, the ''add friend'' butto...