mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
eager load weight and school
This commit is contained in:
@@ -41,7 +41,7 @@ class StaticPagesController < ApplicationController
|
||||
@weight = Weight.find(params[:weight])
|
||||
@tournament = Tournament.find(@weight.tournament_id)
|
||||
@matches = @tournament.matches.select{|m| m.weight_id == @weight.id}
|
||||
@wrestlers = Wrestler.where(weight_id: @weight.id)
|
||||
@wrestlers = Wrestler.where(weight_id: @weight.id).includes(:weight,:school)
|
||||
if @matches.empty? or @wrestlers.empty?
|
||||
redirect_to "/static_pages/noMatches?tournament=#{@tournament.id}"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user