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| %> - <%= link_to 'Show', friendship %> <%= link_to 'Destroy', friendship, method: :delete, data: { confirm: 'Are you sure?' } %> <% end %> @@ -19,4 +18,4 @@
-<%= link_to 'New Friendship', new_friendship_path %> +<%= link_to 'Add a Friend', users_path %> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index ce34f14..de81b9e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -22,6 +22,10 @@