1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-02 21:24:25 +00:00

Eager load users and delegates for tournaments, eager load delegates and tournament for schools

This commit is contained in:
2016-01-20 20:37:15 +00:00
parent c0ab1cc56c
commit 911faceb7c
6 changed files with 16 additions and 16 deletions

View File

@@ -82,12 +82,12 @@ class MatsController < ApplicationController
def check_access
if params[:tournament]
@tournament = Tournament.find(params[:tournament])
@tournament = Tournament.where(:id => params[:tournament]).includes(:delegates,:user).first
elsif params[:mat]
@mat = Mat.new(mat_params)
@tournament = Tournament.find(@mat.tournament_id)
@tournament = Tournament.where(:id => @mat.tournament_id).includes(:delegates,:user).first
elsif @mat
@tournament = @mat.tournament
@tournament = Tournament.where(:id => @mat.tournament.id).includes(:delegates,:user).first
end
authorize! :manage, @tournament
end