rails/rails — pull request #12072 by smolnar (2013-08-29 16:00:03+00:00)
Title: Hash#deep_merge does not yield block for false boolean value.

When applying deep_merge with block on Hash with *false* keys, the block does not get yielded.

https://github.com/rails/rails/blob/ef5d85709d346e55827e88f53430a2cbe1e5fb9e/activesupport/lib/active_support/core_ext/hash/deep_merge.rb#L22

The value `tv` should be properly checked for nil, e.g. `!tv.nil?`.

Failing test:

```ruby
def test_deep_merge_with_block_for_boolean_values
hash_1 = { c: { c1: false, c2: false } }
hash_2 = { c: { c1: true } }

expected = { c: { c1: [:c1, false, true], c2: false } }

assert_equal(expected, hash_1.deep_merge(hash_2) { |key, old, n| [key, old, n] })

hash_1.deep_merge!(hash_2) { |key, old, n| [key, old, n] }
assert_equal expected, hash_1
end
```

Test output:
```
--- expected
+++ actual
@@ -1 +1 @@
-{:c=>{:c1=>[:c1, false, true], :c2=>false}}
+{:c=>{:c1=>true, :c2=>false}}
```