From 32fccb4a8de96210ba1b7c90ed5563488ff59dea Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Wed, 15 Oct 2014 17:00:22 -0400 Subject: [PATCH] Quick sample for listing friends --- app/controllers/friendships_controller.rb | 1 + app/views/friendships/index.html.erb | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/friendships_controller.rb b/app/controllers/friendships_controller.rb index 4c79f15..31f91da 100644 --- a/app/controllers/friendships_controller.rb +++ b/app/controllers/friendships_controller.rb @@ -2,6 +2,7 @@ class FriendshipsController < ApplicationController before_action :require_login def index + @friends = current_user.friends @friendships = Friendship.all end diff --git a/app/views/friendships/index.html.erb b/app/views/friendships/index.html.erb index fa9cd4b..ddb29a2 100644 --- a/app/views/friendships/index.html.erb +++ b/app/views/friendships/index.html.erb @@ -8,8 +8,9 @@ - <% @friendships.each do |friendship| %> + <% @friends.each do |friendship| %> + <%= friendship.name %> <%= link_to 'Destroy', friendship, method: :delete, data: { confirm: 'Are you sure?' } %> <% end %>