1
0
Fork 0

Quick sample for listing friends

This commit is contained in:
Andrew Tomaka 2014-10-15 17:00:22 -04:00
parent 49368933cc
commit 32fccb4a8d
2 changed files with 3 additions and 1 deletions

View file

@ -2,6 +2,7 @@ class FriendshipsController < ApplicationController
before_action :require_login before_action :require_login
def index def index
@friends = current_user.friends
@friendships = Friendship.all @friendships = Friendship.all
end end

View file

@ -8,8 +8,9 @@
</thead> </thead>
<tbody> <tbody>
<% @friendships.each do |friendship| %> <% @friends.each do |friendship| %>
<tr> <tr>
<td><%= friendship.name %></td>
<td><%= link_to 'Destroy', friendship, method: :delete, data: { confirm: 'Are you sure?' } %></td> <td><%= link_to 'Destroy', friendship, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr> </tr>
<% end %> <% end %>