# Deep\_merge! issue

**URL:** <https://www.ruby-forum.com/t/deep-merge-issue/189394>\
**Category:** Rails I18n\
**Created:** [May 31, 2010, 6:44am UTC](https://www.ruby-forum.com/t/deep-merge-issue/189394 "2010-05-31T06:44:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lo\_pan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/54ee81/32.png) [@lo\_pan](https://www.ruby-forum.com/u/lo_pan)\
**Post date:** [May 31, 2010, 6:44am UTC](https://www.ruby-forum.com/t/deep-merge-issue/189394/1 "2010-05-31T06:44:06Z")

</div>

Hi All,

The i18n gem has a deep\_merge! method defined, but so have rails 2.3.x  
and rails 3, and all these implementations differ and have different  
behavior. I was wondering if all implementations should be consolidated  
to the version rails 3 uses ?

The issue I have right now: the 18n gem won’t define its deep\_merge!  
method if activesupport is loaded earlier; which is always the case if  
you run a rails app. This gives the following issue:

Suppose you have your own en.yml file with:

:en  
:date  
:abbr\_day\_names: [sun, mon, tue, wed, thu, fri, sat]

( because you want lowercase day names… )

this used to work with rails 2.3.5, but with the rails 2.3.8 and i18n  
0.4.0 stack this doesn’t work anymore.

As this key is also in the en.yml file provided by rails, when  
+store\_translations+ is called it will perform a +deep\_merge!+, however,  
it will use the deep\_merge! version of active support, not of i18n, and  
the result is that translations[:en][:date][:abbr\_day\_names] will be  
equal to an empty hash instead of the given array.

I currently use a workaround to redefine the deep\_merge! method using  
the rails 3 version, overwriting the version activesupport 2.3.8 has.  
Obviously I’m not too keen to keep this workaround… any suggestions on  
how to consolidate?

Cheers,  
Lawrence
