Avoid N+1 queries with acts_as_taggable
This commit is contained in:
parent
3660d14d44
commit
0814c7cab5
@ -3,7 +3,7 @@ class GuestsController < ApplicationController
|
||||
|
||||
# GET /guests or /guests.json
|
||||
def index
|
||||
@guests = Guest.all
|
||||
@guests = Guest.all.includes(:affinity_groups)
|
||||
end
|
||||
|
||||
# GET /guests/1 or /guests/1.json
|
||||
|
@ -18,7 +18,7 @@
|
||||
<td><%= guest.full_name %></td>
|
||||
<td><%= guest.email %></td>
|
||||
<td><%= guest.phone %></td>
|
||||
<td><%= guest.affinity_group_list %></td>
|
||||
<td><%= guest.affinity_groups.pluck(:name).join(", ") %></td>
|
||||
<td><%= link_to "Show", guest %></td>
|
||||
<td><%= link_to "Edit", edit_guest_path(guest) %></td>
|
||||
</tr>
|
||||
|
Loading…
x
Reference in New Issue
Block a user