Include bets in match resource
This commit is contained in:
parent
f3b8fd4184
commit
041ee4ab2c
|
|
@ -7,7 +7,7 @@ class MatchesController < ApplicationController
|
|||
|
||||
# GET /matches/1
|
||||
def show
|
||||
render json: @match, include: ['match_scores.points', 'match_scores.team']
|
||||
render json: @match, include: ['match_scores.points', 'match_scores.team', 'bets']
|
||||
end
|
||||
|
||||
# PATCH/PUT /matches/1
|
||||
|
|
|
|||
|
|
@ -7,5 +7,10 @@ class MatchSerializer < ApplicationSerializer
|
|||
ActiveModelSerializers::SerializableResource.new(object.winner).as_json
|
||||
end
|
||||
|
||||
def bets
|
||||
ActiveModelSerializers::SerializableResource.new(object.bets, serializer: BetsSerializer).as_json
|
||||
end
|
||||
|
||||
has_many :match_scores
|
||||
has_many :bets
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue