1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-03 13:30:02 +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 WeightsController < ApplicationController
before_action :set_weight, only: [:show, :edit, :update, :destroy]
before_filter :check_access, only: [:new,:create,:update,:destroy]
# GET /weights
# GET /weights.json
@@ -95,4 +96,15 @@ class WeightsController < ApplicationController
def weight_params
params.require(:weight).permit(:max, :tournament_id, :mat_id)
end
def check_access
if params[:tournament]
@tournament = params[:tournament]
else
@tournament = @weight.tournament
end
if current_user != @tournament.user
redirect_to root_path
end
end
end