I have a method that removes some errors from the
ActiveRecord::Base#errors object.  After updating my app to 2.3.4, I
find that the removal process is broken.  Witness:

h = {:a => 1, :b => 2}
oh = ActiveSupport::OrderedHash[:a, 1, :b, 2]

h.slice!(:a)
h.keys   =>   [:a] GOOD
oh.slice!(:a);oh.keys =>  [:a, :b]  OUCH!

NB: #slice works fine on ordered hashes, but not the in-place variant.

This is in Ruby 1.8.7 on Rails 2-3-stable.

So, is this behavior a bug?  It kinda falls into the undefined
behavior, but for consistency/least surprise it should probably remove
the keys from an ordered hash, not just nullify the values.

-Chris
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to