upgrading to ruby 2.3.0 NameError: uninitialized constant I18n::Config::Backend -
i upgraded ruby 2.2.2 2.3.0. whenever run rake task following error:
christians-air:my_rails_app cman77$ rake --trace rake aborted! nameerror: uninitialized constant i18n::config::backend /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `block in run_tasks_blocks' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `each' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:658:in `run_tasks_blocks' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/application.rb:452:in `run_tasks_blocks' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/engine.rb:453:in `load_tasks' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `method_missing' /users/cman77/dropbox/rails_projects/my_rails_app/rakefile:9:in `<top (required)>' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/bin/rake:23:in `load' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/bin/rake:23:in `<main>' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/bin/ruby_executable_hooks:15:in `eval' /users/cman77/.rvm/gems/ruby-2.3.0@jbio.3.0/bin/ruby_executable_hooks:15:in `<main>'
anyone have experience this? stuck in terms of how begin diagnose/remedy issue.
here contents of rakefile:
#!/usr/bin/env rake # add own tasks in files placed in lib/tasks ending in .rake, # example lib/tasks/capistrano.rake, , automatically available rake. require file.expand_path('../config/application', __file__) env['newrelic_enable'] = 'false' myrailsapp::application.load_tasks
this appears offending line referenced in i18n gem: https://github.com/svenfuchs/i18n/blob/master/lib/i18n/config.rb#l18
update: seems tied use of include actionview::helpers::translationhelper
in 1 of rake files. if remove line can run rake commands.
update2: removing include actionview::helpers::translationhelper
, replacing (t "some_text")
(i18n.t "some_text")
resolved issue. still award bounty can explain why broke ruby upgrade!
my guess experienced problem because ere using t
method (an helper controllers , views) in rake task, instead of standard i18n.t
.
this uncommon , unconventional approach, have fallen in possible regression few have experienced , has simple solution, 1 found: stick conventions.
Comments
Post a Comment