1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-10 23:53:06 +00:00

Finished setting owner for tournamenr and protecting paths

This commit is contained in:
2015-10-26 16:31:45 -04:00
parent ad9ea9dc42
commit d18e729012
16 changed files with 109 additions and 86 deletions

View File

@@ -1,5 +1,6 @@
class WrestlersController < ApplicationController
before_action :set_wrestler, only: [:show, :edit, :update, :destroy]
before_filter :check_access, only: [:new,:create,:update,:destroy]
# GET /wrestlers
# GET /wrestlers.json
@@ -101,4 +102,15 @@ class WrestlersController < ApplicationController
def wrestler_params
params.require(:wrestler).permit(:name, :school_id, :weight_id, :seed, :original_seed, :season_win, :season_loss,:criteria,:extra,:offical_weight)
end
def check_access
if params[:tournament]
@tournament = params[:tournament]
else
@tournament = @wrestler.tournament
end
if current_user != @tournament.user
redirect_to root_path
end
end
end