1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-05 06:07:20 +00:00

School delegates permissions are working

This commit is contained in:
2016-01-07 16:08:46 +00:00
parent cbf95ea07b
commit 612902aa91
10 changed files with 92 additions and 12 deletions

View File

@@ -92,13 +92,16 @@ class WrestlersController < ApplicationController
def check_access
if params[:school]
@school = School.find(params[:school])
@tournament = Tournament.find(@school.tournament.id)
#@tournament = Tournament.find(@school.tournament.id)
elsif params[:wrestler]
@school = School.find(params[:wrestler]["school_id"])
@tournament = Tournament.find(@school.tournament.id)
#@tournament = Tournament.find(@school.tournament.id)
elsif @wrestler
@tournament = @wrestler.tournament
@school = @wrestler.school
#@tournament = @wrestler.tournament
elsif wrestler_params
@school = School.find(wrestler_params[:school_id])
end
authorize! :manage, @tournament
authorize! :manage, @school
end
end