Puma 发现了此错误:无效的选项键:raise_on_unfiltered_pa​​rameters

use*_*452 5 ruby-on-rails railstutorial.org

我正在通过 Michael Hartl 的书学习 Ruby on RailsRuby on Rails\xe2\x84\xa2 Tutorial: Learn Web Development with Rails, Fourth Edition。我在尝试时收到错误消息toy_app。有谁知道出了什么问题吗?

\n
Puma caught this error: Invalid option key: raise_on_unfiltered_parameters= (RuntimeError)\n.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/railtie.rb:59:in `block (3 levels) in <class:Railtie>'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/railtie.rb:54:in `each'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/railtie.rb:54:in `block (2 levels) in <class:Railtie>'\n.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'\n.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'\n.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'\n.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `each'\n.gem/ruby/gems/activesupport-5.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/base.rb:263:in `<class:Base>'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/base.rb:164:in `<module:ActionController>'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_controller/base.rb:5:in `<top (required)>'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_dispatch/middleware/static.rb:77:in `ext'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_dispatch/middleware/static.rb:33:in `match?'\n.gem/ruby/gems/actionpack-5.0.0/lib/action_dispatch/middleware/static.rb:130:in `call'\n.gem/ruby/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'\n.gem/ruby/gems/railties-5.0.0/lib/rails/engine.rb:522:in `call'\n.gem/ruby/gems/puma-3.4.0/lib/puma/configuration.rb:224:in `call'\n.gem/ruby/gems/puma-3.4.0/lib/puma/server.rb:569:in `handle_request'\n.gem/ruby/gems/puma-3.4.0/lib/puma/server.rb:406:in `process_client'\n.gem/ruby/gems/puma-3.4.0/lib/puma/server.rb:271:in `block in run'\n.gem/ruby/gems/puma-3.4.0/lib/puma/thread_pool.rb:114:in `call'\n.gem/ruby/gems/puma-3.4.0/lib/puma/thread_pool.rb:114:in `block in spawn_thread'\n
Run Code Online (Sandbox Code Playgroud)\n

更新:注释掉raise_on_unfiltered_parameters可以解决问题。

\n

小智 3

我遇到了同样的问题,这就是我解决它的方法:转到

配置/初始化程序/new_framework_defaults.rb

并注释或删除这行代码:

 Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
Run Code Online (Sandbox Code Playgroud)

我希望这有帮助