From 73cc9c24df2ed864636c37f8cfea97039d430a0d Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Fri, 24 Oct 2014 11:26:44 -0400 Subject: [PATCH] Delete friendships --- app/controllers/friendships_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index 50c12a6..673ae10 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -18,7 +18,8 @@ class FriendshipsController < ApplicationController end def destroy - @friendship = Friendship.find(params[:id]) + @friendship = Friendship.where(user_id: current_user.id, + friend_id: params[:id]).take @friendship.destroy flash[:success] = 'Friend has been removed from your friends'