lib/popular/popular.rb
def befriend! new_friend
      run_callbacks :befriend do
        friendships.create! friend_id: new_friend.id, friend_type: new_friend.class.name
      end
    end
def befriend! new_friend
      run_callbacks :befriend do
        friendships.create! friend_id: new_friend.id, friend_type: new_friend.class.name
      end
    end
def befriend! new_friend run_callbacks :befriend do friendships . create! friend_id : new_friend . id , friend_type : new_friend . class . name end end
Adds a friend to an instance's friend's list
 Similar to .befriend, but will raise an error if the operation is not successful

 @param [Object] new_friend a popular_model that the instance is not already friends with

 @example
   user = User.create name: "Justin"
   other_user = User.create name: "Jenny"
   user.befriend! other_user

   user.friends_with? other_user # => true
Adds a friend to an instance s friend s list Similar to . befriend but will raise an error if the operation is not successful