Add games to players
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
class PlayerController < ApplicationController
|
||||
def show
|
||||
@player = Player.find(params[:id])
|
||||
@games = Game.where(winner: @player.name).or(Game.where(loser: @player.name))
|
||||
@player.alternate_players.each do |alt|
|
||||
@games += Game.where(winner: alt.name).or(Game.where(loser: alt.name))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user