summaryrefslogtreecommitdiff
path: root/app/controllers/matches_controller.rb
diff options
context:
space:
mode:
authorshumakl <shumakl@purdue.edu>2014-04-03 12:12:04 -0400
committershumakl <shumakl@purdue.edu>2014-04-03 12:12:04 -0400
commitc0b705f1397ce442427638f92b185d630db73ec5 (patch)
tree61d0b3692fa91b41983355b3456d36d5638eada3 /app/controllers/matches_controller.rb
parentac4a9438709356f7f270476e30b3f4e572f4bf6a (diff)
normalize to tab indent
Diffstat (limited to 'app/controllers/matches_controller.rb')
-rw-r--r--app/controllers/matches_controller.rb132
1 files changed, 66 insertions, 66 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb
index 53028a4..8d65960 100644
--- a/app/controllers/matches_controller.rb
+++ b/app/controllers/matches_controller.rb
@@ -1,77 +1,77 @@
class MatchesController < ApplicationController
- before_action :set_tournament, only: [:index, :new, :create]
- before_action :set_match, only: [:show, :edit, :update, :destroy]
- # GET /matches
- # GET /matches.json
- def index
- @matches = @tournament.matches
- end
+ before_action :set_tournament, only: [:index, :new, :create]
+ before_action :set_match, only: [:show, :edit, :update, :destroy]
+ # GET /matches
+ # GET /matches.json
+ def index
+ @matches = @tournament.matches
+ end
- # GET /matches/1
- # GET /matches/1.json
- def show
- end
+ # GET /matches/1
+ # GET /matches/1.json
+ def show
+ end
- # GET /matches/new
- def new
+ # GET /matches/new
+ def new
- end
+ end
- # GET /matches/1/edit
- def edit
- end
+ # GET /matches/1/edit
+ def edit
+ end
- # POST /matches
- # POST /matches.json
- def create
- @match = @tournament.matches.build(match_params)
+ # POST /matches
+ # POST /matches.json
+ def create
+ @match = @tournament.matches.build(match_params)
- respond_to do |format|
- if @match.save
- format.html { redirect_to tournament_matches_path, notice: 'Match was successfully created.' }
- format.json { render action: 'show', status: :created, location: @match }
- else
- format.html { render action: 'new' }
- format.json { render json: @match.errors, status: :unprocessable_entity }
- end
- end
- end
+ respond_to do |format|
+ if @match.save
+ format.html { redirect_to tournament_matches_path, notice: 'Match was successfully created.' }
+ format.json { render action: 'show', status: :created, location: @match }
+ else
+ format.html { render action: 'new' }
+ format.json { render json: @match.errors, status: :unprocessable_entity }
+ end
+ end
+ end
- # PATCH/PUT /matches/1
- # PATCH/PUT /matches/1.json
- def update
- respond_to do |format|
- if @match.update(match_params)
- format.html { redirect_to [@tournament, @match], notice: 'Match was successfully updated.' }
- format.json { head :no_content }
- else
- format.html { render action: 'edit' }
- format.json { render json: @match.errors, status: :unprocessable_entity }
- end
- end
- end
+ # PATCH/PUT /matches/1
+ # PATCH/PUT /matches/1.json
+ def update
+ respond_to do |format|
+ if @match.update(match_params)
+ format.html { redirect_to [@tournament, @match], notice: 'Match was successfully updated.' }
+ format.json { head :no_content }
+ else
+ format.html { render action: 'edit' }
+ format.json { render json: @match.errors, status: :unprocessable_entity }
+ end
+ end
+ end
- # DELETE /matches/1
- # DELETE /matches/1.json
- def destroy
-
- @match.destroy
- respond_to do |format|
- format.html { redirect_to tournament_matches_path }
- end
- end
+ # DELETE /matches/1
+ # DELETE /matches/1.json
+ def destroy
- private
- # Use callbacks to share common setup or constraints between actions.
- def set_match
- @tournament = Tournament.find(params[:tournament_id])
- @match = @tournament.matches.find(params[:id]);
- end
- def set_tournament
- @tournament = Tournament.find(params[:tournament_id])
- end
- # Never trust parameters from the scary internet, only allow the white list through.
- def match_params
- params.require(:match).permit(:status, :tournament_id, :name, :winner_id, :remote_id)
- end
+ @match.destroy
+ respond_to do |format|
+ format.html { redirect_to tournament_matches_path }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_match
+ @tournament = Tournament.find(params[:tournament_id])
+ @match = @tournament.matches.find(params[:id]);
+ end
+ def set_tournament
+ @tournament = Tournament.find(params[:tournament_id])
+ end
+ # Never trust parameters from the scary internet, only allow the white list through.
+ def match_params
+ params.require(:match).permit(:status, :tournament_id, :name, :winner_id, :remote_id)
+ end
end