require 'active_support' or 'i18n' first ?

E

Eugen Ciur

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 ?
 
C

Christopher Dicely

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 =C2=A0rai= ses
an exception:

=C2=A0$ irb
ruby-1.9.2-p0 > require 'i18n'
=C2=A0=3D> true
ruby-1.9.2-p0 > require 'active_support'
=C2=A0=3D> true
ruby-1.9.2-p0 > exit
eugen@eugen-hp:~$ =C2=A0$ irb
ruby-1.9.2-p0 > require 'active_support'
=C2=A0=3D> true
ruby-1.9.2-p0 > require 'i18n'
NameError: uninitialized constant Object::I18n
=C2=A0from
/home/eugen/.rvm/gems/ruby-1.9.2-p0/gems/activesupport-3.0.1/lib/active_s= upport/i18n.rb:8:in
`<top (required)>'
=C2=A0from
/home/eugen/.rvm/gems/ruby-1.9.2-p0/gems/i18n-0.5.0/lib/i18n/version.rb:1= :in
`<top (required)>'
=C2=A0from <internal:lib/rubygems/custom_require>:29:in `require'
=C2=A0from <internal:lib/rubygems/custom_require>:29:in `require'
=C2=A0from
/home/eugen/.rvm/gems/ruby-1.9.2-p0/gems/i18n-0.5.0/lib/i18n.rb:1:in
`<top (required)>'
=C2=A0from <internal:lib/rubygems/custom_require>:33:in `require'
=C2=A0from <internal:lib/rubygems/custom_require>:33:in `rescue in requir= e'
=C2=A0from <internal:lib/rubygems/custom_require>:29:in `require'
=C2=A0from (irb):2
=C2=A0from /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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top