rails/rails — pull request #16357 by gchan (2014-07-31 07:24:31+00:00)
Title: `HashWithIndifferentAccess.new` respects the default value or proc on objects that respond to `#to_hash`

Builds on the work of #12550 where `.new` will convert the object (that respond to `#to_hash`) to a hash and add that hash's keys and values to itself.

This change will also make `.new` respect the default value or proc of objects that respond to `#to_hash`.
In other words, this `.new` behaves exactly like `.new_from_hash_copying_default`.

`.new_from_hash_copying_default` now simply invokes `.new` and any references to `.new_from_hash_copying_default` are replaced with `.new`.

Should we deprecate `.new_from_hash_copying_default` now it is consistent with `.new`?

Added tests confirm behavior.

---------

This PR is a work in progress. Feedback is appreciated.