How can I load this from fewer queries?
Current code; Controller;
@players = @season.players.includes(:stats)
Views;
<% @players.each do |player| %>
<%= player.stats.where(season: @season).each do |stat| %>
<% end %>
<% end %>
Thank you.
Aucun commentaire:
Enregistrer un commentaire