diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index e0e6ef8..4c79f15 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -18,6 +18,11 @@ class FriendshipsController < ApplicationController end def destroy + @friendship = Friendship.find(params[:id]) + + @friendship.destroy + flash[:success] = 'Friend has been removed from your friends' + redirect_to friendships_path end private diff --git a/app/views/friendships/index.html.erb b/app/views/friendships/index.html.erb index be65d7e..fa9cd4b 100644 --- a/app/views/friendships/index.html.erb +++ b/app/views/friendships/index.html.erb @@ -10,7 +10,6 @@
<% @friendships.each do |friendship| %>