Add winner attribute to match serializer

This commit is contained in:
Thor77 2019-05-28 23:18:12 +02:00
parent 4e0da7f8ab
commit 91fe9dba16
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
1 changed files with 5 additions and 1 deletions

View File

@ -1,7 +1,11 @@
# frozen_string_literal: true
class MatchSerializer < ApplicationSerializer
attributes :state, :position
attributes :state, :position, :winner
def winner
ActiveModelSerializers::SerializableResource.new(object.winner).as_json
end
has_many :match_scores
end