On Wed, May 4, 2011 at 1:49 PM, Eugen Ciur <ciur.eugen / gmail.com> wrote:
> Hi all,
>
> I discovered recently a strange behavior. If I require 'i18n' gem then
> 'active_support' then everything is ok, if I change order - irb raises
> an exception:
>
> $ irb
> ruby-1.9.2-p0 > require 'i18n'
> => true
> ruby-1.9.2-p0 > require 'active_support'
> => true
> ruby-1.9.2-p0 > exit
> eugen@eugen-hp:~$ $ irb
> ruby-1.9.2-p0 > require 'active_support'
> => true
> ruby-1.9.2-p0 > require 'i18n'
> NameError: uninitialized constant Object::I18n
> from
> /home/eugen/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_support/i18n.rb:8:in
> `<top (required)>'
> from
> /home/eugen/.rvm/gems/ruby-1.9.2-p0/gems/i18n-0.5.0/lib/i18n/version.rb:1:in
> `<top (required)>'
> from <internal:lib/rubygems/custom_require>:29:in `require'
> from <internal:lib/rubygems/custom_require>:29:in `require'
> from
> /home/eugen/.rvm/gems/ruby-1.9.2-p0/gems/i18n-0.5.0/lib/i18n.rb:1:in
> `<top (required)>'
> from <internal:lib/rubygems/custom_require>:33:in `require'
> from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
> from <internal:lib/rubygems/custom_require>:29:in `require'
> from (irb):2
> from /home/eugen/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'
>
> It is a bug? Any idea ?

It seems like it might be a side-effect of a bug in the version of
Active Support you are using; I get the same thing when using that
version (3.0.1), but using the current version of Active Support
(3.0.7), I just get a false back on the require 'i18n' done after
require 'active_support', which is expected because Active Support
does a require 'i18n', so requiring both is redundant.

Updating Active Support (if using Rails, you probably want to do the
whole Rails stack) to the current release should stop this behavior
from manifesting, but you probably don't need to require both of these
gems anyway, given the redundancy.