17 lines
462 B
Ruby
17 lines
462 B
Ruby
json.extract! @game, :id, :title, :created_at, :updated_at, :current_player_id
|
|
if @game.current_player == @game.try(:player_to_beat)
|
|
json.play_to_beat_string "None"
|
|
else
|
|
json.play_to_beat_string @game.play_to_beat.try(:play).try(:to_s)
|
|
end
|
|
|
|
json.players @game.players do |player|
|
|
json.id player.id
|
|
json.email player.user.email
|
|
json.inventory_count player.inventory.count
|
|
|
|
if player.user == current_user
|
|
json.inventory player.inventory
|
|
end
|
|
end
|