Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a friend multiple times. #31

Open
teethgrinder opened this issue Jul 19, 2012 · 1 comment
Open

Adding a friend multiple times. #31

teethgrinder opened this issue Jul 19, 2012 · 1 comment

Comments

@teethgrinder
Copy link

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
Copy link

current_user.friend_with?(@user)

You should also check pending invites.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants