Set global match var for reuse by other methods
This commit is contained in:
parent
1b9db61c22
commit
436adde706
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue