Rails 5 升级:/actionpack-5.0.0/lib/action_controller/test_case.rb:49:in `initialize': 参数数量错误(0 代表 2)(ArgumentError)

Rails 5 Upgrade : /actionpack-5.0.0/lib/action_controller/test_case.rb:49:in `initialize': wrong number of arguments (0 for 2) (ArgumentError)

我最近正在进行 Rails 5 升级,当我尝试启动 rails 控制台时 运行 遇到了这个错误:

/actionpack-5.0.0/lib/action_controller/test_case.rb:49:in initialize': wrong number of arguments (0 for 2) (ArgumentError)

目前 bundle update rails 已完成 gem 依赖项的解决,足以更新到 5.0.0,rspec 正在 运行ning(尽管有很多休息我正在修复)。我也可以 运行 rails s 而不会出错。

这里是代码中断行:

https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/test_case.rb

全栈:

/Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/actionpack-5.0.0/lib/action_controller/test_case.rb:49:in `initialize': wrong number of arguments (0 for 2) (ArgumentError) from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/view_context/build_strategy.rb:41:in `new' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/view_context/build_strategy.rb:41:in `block in controller' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/view_context/build_strategy.rb:40:in `tap' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/view_context/build_strategy.rb:40:in `controller' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/view_context/build_strategy.rb:30:in `call' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/view_context.rb:49:in `build' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/draper-2.1.0/lib/draper/railtie.rb:63:in `block in <class:Railtie>' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/railtie.rb:226:in `call' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/railtie.rb:226:in `block in run_console_blocks' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/railtie.rb:247:in `each' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/railtie.rb:247:in `each_registered_block' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/railtie.rb:226:in `run_console_blocks' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/application.rb:463:in `block in run_console_blocks' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/engine/railties.rb:13:in `each' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/engine/railties.rb:13:in `each' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/application.rb:463:in `run_console_blocks' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/engine.rb:442:in `load_console' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/commands/console.rb:34:in `initialize' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/commands/console_helper.rb:9:in `new' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/commands/console_helper.rb:9:in `start' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:78:in `console' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /Users/this_is_my_username/.rvm/gems/ruby-2.2.3/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>' from bin/rails:4:in `require' from bin/rails:4:in `<main>'

感谢 Scott W.

问题大部分在这里回答:

我想澄清一下,gem 'draper', github: 'drapergem/draper', branch: 'rails-5' 不再有效,但 gem 'draper', github: 'audionerd/draper', branch: 'rails5' 确实修复了这个错误。