Patch 10463: has_many through using uniq does not honor order

Hi,

I've just submitted a patch for ActiveRecord;

  http://dev.rubyonrails.org/ticket/10463

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.

Thanks, Remco

I suppose to_set.to_a was an optimization. I had a similar patch is the past - http://dev.rubyonrails.org/ticket/8802 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}

  Benchmark.bm do |bm|     bm.report 'to_set.to_a' do       data.to_set.to_a     end

    bm.report 'uniq' do       data.uniq     end   end