title: Retrieving instance from array in ruby
body: <p>I have a <code>scoreboard</code> that has many <code>games</code>. <code>game</code> has_many <code>users</code> and <code>user</code> has_many <code>games</code>, so I have a join table/model <code>game_users</code>.
  <code>Scoreboard</code> belongs_to <code>competition</code>. My admin can generate a scoreboard linked to a competition.
  The idea is to generate the scoreboard and (<code>@competition.users.count / 2</code>) games on that scoreboard (provided we have a even number of players). A game is a confrontation between 2 players. </p>
  
  <p>In my scoreboard_controller, I have :</p>
  
  <pre><code> def create
      @scoreboard = Scoreboard.new
      @scoreboard.competition = @competition
      authorize @scoreboard
  
      if @scoreboard.save
        if @competition.users &amp;&amp; @competition.users.count.even?
          @total_players = @competition.users
          num = 0
          for num in 0..(@competition.users.count / 2) do
            game = Game.new(scoreboard: @scoreboard)
            game.save
            gameUserFirst = GameUser.new(game: game, user: @total_players.sample)
            @total_players = @total_players.except(gameUserFirst.user)
            gameUserSecond = GameUser.new(game: game, user: @total_players.sample)
            @total_players = @total_players.except(gameUserSecond.user)
            gameUserFirst.save
            gameUserSecond.save
            num += 1
          end
        end
        redirect_to  competition_scoreboard_path(@competition, @scoreboard)
      else
      end
    end
  </code></pre>
  
  <p>My goal is to generate games between random players, but I dont want a player to be selected twice or to play against himself. In order to prevent this, as soon as it is used in the  <code>GameUser</code> object, I want to retrieve it from the  <code>@total_players</code> array. 
  Unfortunately the <code>.except</code> method doesn't seem to work with instances. How can I achieve that ?</p>