mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-04 13:43:48 +00:00
Created a weigh in page
This commit is contained in:
@@ -98,4 +98,31 @@ class StaticPagesController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def weigh_in
|
||||
if !user_signed_in?
|
||||
redirect_to root_path
|
||||
end
|
||||
if params[:wrestler]
|
||||
Wrestler.update(params[:wrestler].keys, params[:wrestler].values)
|
||||
end
|
||||
if params[:tournament]
|
||||
@tournament = Tournament.find(params[:tournament])
|
||||
@tournament_id = @tournament.id
|
||||
@tournament_name = @tournament.name
|
||||
end
|
||||
if @tournament
|
||||
@weights = Weight.where(tournament_id: @tournament.id)
|
||||
@weights = @weights.sort_by{|x|[x.max]}
|
||||
end
|
||||
if params[:weight]
|
||||
@weight = Weight.find(params[:weight])
|
||||
@tournament_id = @weight.tournament_id
|
||||
@tournament_name = Tournament.find(@tournament_id).name
|
||||
end
|
||||
if @weight
|
||||
@wrestlers = @weight.wrestlers
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user