Patch 10463: has_many through using uniq does not honor order


I've just submitted a patch for ActiveRecord;

The patch includes new fixtures because I could not find a applicable
combination among the existing fixtures. I hope that's okee.

Please +1 or comment it.


I suppose to_set.to_a was an optimization. I had a similar patch is
the past - But you have more
tests and a valid point, so +1.

It'd be great if you could somehow find a way to use existing
fixtures. No big deal though.

Thanks for you vote! I also guessed to_set.to_a is an optimization
but a naive benchmark shows it actually slower:

  require 'set'
  require 'benchmark'

  data = (1..1000_000).map{rand 1000} do |bm| 'to_set.to_a' do
    end 'uniq' do