Went to use ActiveSupport in a gem today and got an error on account of
not
having i18n installed. Either bundler should be installing i18n along
with
activesupport or docs need to be updated.
quick repro: GitHub - softwaregravy/repro_active_support_i18n
bundle exec irb
require ‘active_support/all’
detailed steps and error:
-
add to Gemfile
require ‘activesupport’ -
try it out
bundle exec irb
require ‘active_support/core_ext’
You don’t have i18n installed in your application. Please add it to your
Gemfile and run bundle install
LoadError: no such file to load – i18n
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/i18n.rb:2:in
require' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/i18n.rb:2:in
<top (required)>’
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/inflector/transliterate.rb:3:in
require' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/inflector/transliterate.rb:3:in
<top (required)>’
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/string/inflections.rb:3:in
require' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/string/inflections.rb:3:in
<top (required)>’
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array/conversions.rb:4:in
require' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array/conversions.rb:4:in
<top (required)>’
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array.rb:4:in
require' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext/array.rb:4:in
<top (required)>’
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:2:in
require' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:2:in
block in <top (required)>’
from
/Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:1:in
each' from /Users/MacbookPro/.rvm/gems/ruby-1.9.2-p0@thinknear-ruby/gems/activesupport-3.0.9/lib/active_support/core_ext.rb:1:in
<top (required)>’
from (irb):1:inrequire' from (irb):1 from /Users/MacbookPro/.rvm/rubies/ruby-1.9.2-p0/bin/irb:16:in
'ruby-1.9.2-p0 :002 > exit
Sure enough i18n is not installed by bundler when requiring
activesupport.
Fix: adding require i18n to my Gemfile and running the bundle install
did
fix the problem.
When running bundle install, I see
Using activesupport (3.0.9)
Looked at the source, I see the dependency listed in the gemspec.
I’m unblocked, but I’m of the opinion that I should not have needed to
add
i18n as a dependency of my project. If that’s not the case, then we
should
update the docs that say 'to use activesupport, just add “require
‘activesupport’” to your Gemfile to mention the requirement for i18n