summaryrefslogtreecommitdiff
path: root/app/controllers/matches_controller.rb
diff options
context:
space:
mode:
authorLuke Shumaker <shumakl@purdue.edu>2014-04-22 18:29:17 -0400
committerLuke Shumaker <shumakl@purdue.edu>2014-04-22 18:29:17 -0400
commitb4bc055585dee532653a8c64e45385e085ec22a8 (patch)
tree6ecad9d0bee5fd547ad0e68ec58bb8fde226e848 /app/controllers/matches_controller.rb
parenta185e81094bed6626ac69449eff0f01bdfbc5197 (diff)
I hate code
Diffstat (limited to 'app/controllers/matches_controller.rb')
-rw-r--r--app/controllers/matches_controller.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 59f376a..b50aca5 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -1,6 +1,4 @@
class MatchesController < ApplicationController
- before_action :set_tournament, only: [:index, :update]
-
require 'httparty'
require 'json'
require 'delayed_job'
@@ -118,7 +116,7 @@ class MatchesController < ApplicationController
# GET /tournaments/1/matches/1
# GET /tournaments/1/matches/1.json
def show
- if Tournament.find_by_id(@match.tournament_id).game_id == 1
+ if @match.tournament_stage.tournament.game_id == 1
file_blue = "blue.yaml"
file_purple = "purple.yaml"
@blue2 = YAML.load_file(file_blue)
@@ -235,11 +233,8 @@ class MatchesController < ApplicationController
private
# Use callbacks to share common setup or constraints between actions.
def set_match
- set_tournament
- @match = @tournament.matches.find(params[:id])
- end
- def set_tournament
- @tournament = Tournament.find(params[:tournament_id])
+ @match = Match.find(params[:id])
+ @tournament = @match.tournament_stage.tournament
end
# Never trust parameters from the scary internet, only allow the white list through.