In Ruby 2.1.0 or earlier, the reject method in any class that inherits
Hash returns an object of its own class.
But in Ruby 2.1.1, this behavior has changed accidentally to return always
a plain Hash object, not of the inherited class.

class SubHash < Hash

p { }.class
#=> 2.1.0: Hash, 2.1.1: Hash
p { }.class
#=> 2.1.0: SubHash, 2.1.1: Hash

(To be exact, extra states such as instance variables, etc. aren’t
copied either.)

Ruby 2.1.1 shouldn’t include such behavior changes, because with the release
of Ruby 2.1.0 we’ve changed our versioning policy,
so Ruby 2.1.1 is a patch level release and it shouldn’t break backwards

This regression could potentially affect many libraries, one such case is
Rails’ HashWithIndifferentAccess and OrderedHash. They are broken:
Rails’ issue #14188.

This behavior will be reverted to the 2.1.0 behavior in Ruby 2.1.2,
but is expected to be the default behavior for Ruby 2.2.0:
Feature #9223.
So we recommend to fix your code in order to expect this behavior change.

This accident is caused by one missing backport commit. For more details, see

Sorry for any inconvenience, and thank you for your support.

Posted by sorah on 10 Mar 2014

Read more at the source