This project is archived and is in readonly mode.

#5843 ✓resolved
Gaius Centus Novus

[PATCH] ActiveSupport::OrderedHash#select does not preserve order

Reported by Gaius Centus Novus | October 20th, 2010 @ 12:30 AM | in 3.0.2

#select does not preserve order, though #find_all does.

    h = ActiveSupport::OrderedHash.new
    h['one'] = '1'
    h['two'] = '1'
    h['three'] = '1'
    
    h.find_all { true }
    # => [["one", "1"], ["two", "2"], ["three", "3"]]
    
    h.select { true }
    # => [["three", "3"], ["two", "2"], ["one", "1"]]

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages