Set global match var for reuse by other methods

This commit is contained in:
Thor77 2019-05-07 15:33:21 +02:00
parent 1b9db61c22
commit 436adde706
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 9 additions and 1 deletions

View File

@ -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