raw1z / amistad

Adds friendships management into a rails application
http://github.com/raw1z/amistad
MIT License
185 stars 71 forks source link

Adding a friend multiple times. #31

Open teethgrinder opened 12 years ago

teethgrinder commented 12 years ago

Hello , I am using amistad now. It is a nice gem but i can add a friend many times. Can you show me a way to avoid it? this is my link to add friends , I could avoid self friendship. :

<% unless current_user == @user %> <%= link_to "Arkadaşlarıma Ekle", friends_path(:user_id => @user), :method => :post,class: "btn btn-large btn-primary" %> <%end %>

emrekutlu commented 11 years ago
current_user.friend_with?(@user)

You should also check pending invites.

current_user.pending_invited_by.include?(@user)
current_user.pending_invited.include?(@user)