diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index d15e841..549f4d7 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -1,8 +1,16 @@ # frozen_string_literal: true class MatchesController < ApplicationController + before_action :set_match, only: %i[show update] + # GET /matches/1 def show - render json: Match.find(params[:id]), include: ['match_scores.points', 'match_scores.team'] + render json: @match, include: ['match_scores.points', 'match_scores.team'] + end + + private + + def set_match + @match = Match.find(params[:id]) end end