我正在开发中将应用程序从 Rails 4.2 升级到 Rails 5 beta1.1。应用程序在升级前运行良好。我已经完成了基本的升级步骤(更新 Ruby、更新 Rails 和相关步骤:http ://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html )。Gemfile 也已更新为最新的 Gems。
当我运行 $ rails middleware 或 $ rails console 或 $ rails server 时,我收到以下错误:
No such middleware to insert after: ActionDispatch::ParamsParser
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/actionpack/lib/action_dispatch/middleware/stack.rb:108:in `assert_index'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/actionpack/lib/action_dispatch/middleware/stack.rb:80:in `insert_after'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:69:in `block in merge_into'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:68:in `each'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/configuration.rb:68:in `merge_into'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/engine.rb:507:in `block in app'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/engine.rb:504:in `synchronize'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/engine.rb:504:in `app'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application/finisher.rb:34:in `block in <module:Finisher>'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:30:in `instance_exec'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:30:in `run'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:55:in `block in run_initializers'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/initializable.rb:54:in `run_initializers'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application.rb:350:in `initialize!'
.../config/environment.rb:5:in `<top (required)>'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:302:in `require'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:302:in `block in require'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:268:in `load_dependency'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/activesupport/lib/active_support/dependencies.rb:302:in `require'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application.rb:326:in `require_environment!'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/application.rb:446:in `block in run_tasks_blocks'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/command.rb:20:in `run'
.../.rvm/gems/ruby-2.3.0/bundler/gems/rails-dbf67b3a6f54/railties/lib/rails/commands.rb:19:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
这与 ActionDispatch::ParamsParser 已从 Rails 5 beta 中间件(https://github.com/rails/rails/commit/38d2bf5fd1f3e014f2397898d371c339baa627b1)中删除的事实有关。但是,在某种程度上,我的应用程序似乎仍在寻找它。
我在 config/application.rb 中尝试了 ActionDispatch::ParamsParser 的各种操作,例如删除它,当这不起作用时,我也尝试添加它。同样的错误。有什么办法可以克服这个错误?