Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am recently working through a Rails 5 upgrade, and am running into this error when I try to fire up the rails console:

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

Currently bundle update rails has finished with gem dependencies resolved enough to to do the update to 5.0.0, rspec is running (albeit with a lot of breaks I am fixing). I can also run rails s without an error.

Here is the line of code breaking:

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

Full stack:

/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>'

like image 704
Nick Schwaderer Avatar asked Aug 02 '16 09:08

Nick Schwaderer


1 Answers

Kudos to Scott W.

Issue mostly answered here: Ruby on Rails 5.0 upgrade not working with rails console or db:migrate

I want to clarify that gem 'draper', github: 'drapergem/draper', branch: 'rails-5' no longer works, but gem 'draper', github: 'audionerd/draper', branch: 'rails5' did work to fix this error.

like image 68
Nick Schwaderer Avatar answered Nov 10 '22 16:11

Nick Schwaderer