title: Order of pairs for each_cons(2)
body: <p>I have a Rails 5.1 application with the following models:</p>
  
  <pre><code>class Game &lt; ApplicationRecord
    has_and_belongs_to_many :players
  end
  
  class Player &lt; ApplicationRecord
    has_and_belongs_to_many :games
  end
  </code></pre>
  
  <p>I see the following behavior in one of <code>Game</code>s methods during tests (using standard fixtures + minitest):</p>
  
  <pre><code>def foo
    puts "players.first: #{players.first.id}, #{players.first.name}"
    puts "players.second: #{players.second.id}, #{players.second.name}"
    puts "players.last: #{players.last.id}, #{players.last.name}"
    players.each_cons(2) do |pair|
      puts "&lt;&lt;each_cons&gt;&gt; one: #{pair.first.id}, #{pair.first.name} - two: #{pair.second.id}, #{pair.second.name}"
    end
  end
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>players.first: 101088061, julia
  players.second: 132733334, clara
  players.last: 931424614, felix
  &lt;&lt;each_cons&gt;&gt; one: 931424614, felix - two: 132733334, clara
  &lt;&lt;each_cons&gt;&gt; one: 132733334, clara - two: 101088061, julia
  </code></pre>
  
  <p>I would expect it to be called with <code>julia, clara</code> and then <code>clara, felix</code>. What could the reason be for this reversed order?</p>