2016-04-19 17 views
2

Ruby 2.2.2を2.3.0にアップグレードしました。レーキタスクを実行するたびに、次のエラーが表示されます。ルビへのアップグレード2.3.0 NameError:未初期化定数I18n :: Config :: Backend

Christians-Air:my_rails_app cman77$ rake --trace 
rake aborted! 
NameError: uninitialized constant I18n::Config::Backend 
/Users/cman77/.rvm/gems/[email protected]/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend' 
/Users/cman77/.rvm/gems/[email protected]/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate' 
/Users/cman77/.rvm/gems/[email protected]/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate' 
/Users/cman77/.rvm/gems/[email protected]/gems/i18n-0.7.0/lib/i18n/config.rb:19:in `backend' 
/Users/cman77/.rvm/gems/[email protected]/gems/i18n-0.7.0/lib/i18n.rb:147:in `translate' 
/Users/cman77/.rvm/gems/[email protected]/gems/actionview-4.2.6/lib/action_view/helpers/translation_helper.rb:69:in `translate' 
/Users/cman77/.rvm/gems/[email protected]/gems/railties-4.2.6/lib/rails/engine.rb:658:in `block in run_tasks_blocks' 
/Users/cman77/.rvm/gems/[email protected]/gems/railties-4.2.6/lib/rails/engine.rb:658:in `each' 
/Users/cman77/.rvm/gems/[email protected]/gems/railties-4.2.6/lib/rails/engine.rb:658:in `run_tasks_blocks' 
/Users/cman77/.rvm/gems/[email protected]/gems/railties-4.2.6/lib/rails/application.rb:452:in `run_tasks_blocks' 
/Users/cman77/.rvm/gems/[email protected]/gems/railties-4.2.6/lib/rails/engine.rb:453:in `load_tasks' 
/Users/cman77/.rvm/gems/[email protected]/gems/railties-4.2.6/lib/rails/railtie.rb:194:in `public_send' 
/Users/cman77/.rvm/gems/[email protected]/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/[email protected]/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/lib/rake/application.rb:75:in `run' 
/Users/cman77/.rvm/gems/[email protected]/gems/rake-11.1.2/bin/rake:33:in `<top (required)>' 
/Users/cman77/.rvm/gems/[email protected]/bin/rake:23:in `load' 
/Users/cman77/.rvm/gems/[email protected]/bin/rake:23:in `<main>' 
/Users/cman77/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `eval' 
/Users/cman77/.rvm/gems/[email protected]/bin/ruby_executable_hooks:15:in `<main>' 

誰でもこの経験がありますか?私は本当にこの問題を診断/救済する方法を始めるにあたっても悩んでいます。ここで

は私のRakefileの内容は次のとおりです。

#!/usr/bin/env rake 
# Add your own tasks in files placed in lib/tasks ending in .rake, 
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 

require File.expand_path('../config/application', __FILE__) 

ENV['NEWRELIC_ENABLE'] = 'false' 

MyRailsApp::Application.load_tasks 

これは、問題のある行は、国際化の宝石で参照されるように表示されます。 https://github.com/svenfuchs/i18n/blob/master/lib/i18n/config.rb#L18

更新:使用に結びついているように見えます私のレーキファイルの1つにinclude ActionView::Helpers::TranslationHelperのその行を削除すると、rakeコマンドを実行できます。

アップデート2include ActionView::Helpers::TranslationHelperの取り外しと(I18n.t "some_text")(t "some_text")を交換するには、問題を完全に解決しました。なぜ私はこれがRubyのアップグレードで壊れたのか説明できる人に賞金を授与します!

+0

エラーを再現するのに役立つ情報を提供できますか? – Elyasin

+0

'/ Users/cman77/Dropbox/rails_projects/my_rails_app/Rakefile'の内容を投稿できます – Sebin

+0

@Sebin私はRakefileの内容を追加しました。 – cman77

答えて

1

標準I18n.tの代わりに、tメソッド(コントローラとビューのヘルパー)をレーキタスクで使用しているため、この問題が発生したと思います。

これは一般的ではない手法なので、few have experiencedという回帰の可能性があります。見つかったような簡単な解決策があります。慣習に従います。

関連する問題