Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[Patch] Fixes OrderedHash.[] constructs a broken hash

#2615

>> Hash[1, 2, 3, 4]
=> {1=>2, 3=>4}
>> Hash[1, 2, 3, 4].keys
=> [1, 3]
>> ActiveSupport::OrderedHash[1, 2, 3, 4]
=> #<OrderedHash {1=>2, 3=>4}>
>> ActiveSupport::OrderedHash[1, 2, 3, 4].keys
TypeError: can't dup NilClass
	from /usr/local/ruby-1.8.6-p287/lib/ruby/gems/1.8/gems/activesupport-2.3.1/lib/active_support/ordered_hash.rb:49:in `dup'
	from /usr/local/ruby-1.8.6-p287/lib/ruby/gems/1.8/gems/activesupport-2.3.1/lib/active_support/ordered_hash.rb:49:in `keys'
	from (irb):4
>> 

Reported by Pete Yandell · May 7th, 2009 @ 08:53 AM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Dougal
    Dougal
    • Title changed from OrderedHash.[] constructs a broken hash to [Patch] Fixes OrderedHash.[] constructs a broken hash
    • Tag set to activesupport, fix, master, patch

    ActiveRecord::OrderedHash.[] method was not available, so ordered keys were never set.

    Fixing patch attached.

    May 8th, 2009 @ 12:10 AM

  2. Frederick Cheung
    Frederick Cheung

    Small nitpick: your test_alternate_initialization test doesn't test anything (i think you've just dropped the assert)

    May 10th, 2009 @ 04:18 PM

  3. Repository
    Repository
    • State changed from new to committed

    (from [2bcb2443a9e2140e29799229d6c63a046e149597]) ActiveSupport::OrderedHash[1,2,3,4] creates an OrderedHash instead of a Hash.

    [#2615 [Patch] Fixes OrderedHash.[] constructs a broken hash state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...

    May 11th, 2009 @ 07:47 PM

  4. Repository
    Repository

    (from [e1854e0b199fba352ddcaa58a3af168e8cc70e3a]) ActiveSupport::OrderedHash[1,2,3,4] creates an OrderedHash instead of a Hash.

    [#2615 [Patch] Fixes OrderedHash.[] constructs a broken hash state:committed]

    Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...

    May 11th, 2009 @ 07:47 PM