Include parent group/stage in .index

This commit is contained in:
Thor77 2019-11-06 15:57:03 +01:00
parent b4418ffd5a
commit 28d047b1bf
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
2 changed files with 9 additions and 1 deletions

View File

@ -15,7 +15,9 @@ class MatchesController < ApplicationController
m.state == match_params['state']
end
end
render json: matches, each_serializer: MatchSerializer, include: '**'
render json: matches, each_serializer: ExtendedMatchSerializer, include: [
'match_scores.team', 'bets', 'stage', 'group'
]
end
# GET /matches/1

View File

@ -0,0 +1,6 @@
# frozen_string_literal: true
class ExtendedMatchSerializer < MatchSerializer
belongs_to :group
belongs_to :stage
end