(pry) output error: #<ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash> と怒られた

rails 5. 1.4 ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16] の環境でform_forを利用して開発している時に見かけたエラー。

controllerの処理の中でbinding.pryを実行し、’params’と確認すると、

(pry) output error: #<ActionController::UnfilteredParameters: unable to convert unpermitted parameters to hash>
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/strong_parameters.rb:265:in `to_h'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/strong_parameters.rb:282:in `to_hash'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/awesome_print-1.8.0/lib/awesome_print/formatter.rb:118:in `convert_to_hash'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/awesome_print-1.8.0/lib/awesome_print/formatter.rb:47:in `awesome_self'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/awesome_print-1.8.0/lib/awesome_print/formatter.rb:28:in `format'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/awesome_print-1.8.0/lib/awesome_print/inspector.rb:115:in `unnested'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/awesome_print-1.8.0/lib/awesome_print/inspector.rb:74:in `awesome'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/awesome_print-1.8.0/lib/awesome_print/core_ext/kernel.rb:10:in `ai'
/Users/fumihumi/project/mercari/.pryrc:4:in `block in __pry__'
/Users/fumihumi/project/mercari/.pryrc:23:in `block in enable_output_method'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:367:in `show_result'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:336:in `block in handle_line'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_class.rb:395:in `critical_section'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:335:in `handle_line'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:243:in `block (2 levels) in eval'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:242:in `catch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:242:in `block in eval'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:241:in `catch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_instance.rb:241:in `eval'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/repl.rb:77:in `block in repl'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/repl.rb:67:in `loop'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/repl.rb:67:in `repl'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/repl.rb:38:in `block in start'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/input_lock.rb:61:in `__with_ownership'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/input_lock.rb:79:in `with_ownership'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/repl.rb:38:in `start'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/repl.rb:13:in `start'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.11.2/lib/pry/pry_class.rb:192:in `start'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-byebug-3.5.0/lib/byebug/processors/pry_processor.rb:115:in `block in resume_pry'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-byebug-3.5.0/lib/byebug/processors/pry_processor.rb:28:in `block in run'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-byebug-3.5.0/lib/byebug/processors/pry_processor.rb:27:in `catch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-byebug-3.5.0/lib/byebug/processors/pry_processor.rb:27:in `run'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-byebug-3.5.0/lib/byebug/processors/pry_processor.rb:111:in `resume_pry'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-byebug-3.5.0/lib/byebug/processors/pry_processor.rb:70:in `at_return'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/byebug-9.1.0/lib/byebug/context.rb:128:in `at_return'
/Users/fumihumi/project/mercari/app/controllers/products_controller.rb:20:in `product_params'
/Users/fumihumi/project/mercari/app/controllers/products_controller.rb:12:in `create'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:186:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:131:in `run_callbacks'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb:20:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `block in instrument'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb:166:in `instrument'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb:252:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb:22:in `process_action'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb:124:in `process'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionview-5.1.4/lib/action_view/rendering.rb:30:in `process'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:189:in `dispatch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb:253:in `dispatch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:31:in `serve'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:50:in `block in serve'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `each'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb:33:in `serve'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:834:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/omniauth-1.4.2/lib/omniauth/strategy.rb:186:in `call!'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/omniauth-1.4.2/lib/omniauth/strategy.rb:164:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bullet-5.6.1/lib/bullet/rack.rb:10:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:36:in `block in call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `catch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/warden-1.2.7/lib/warden/manager.rb:35:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/etag.rb:25:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/conditional_get.rb:38:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/head.rb:12:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:232:in `context'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb:226:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb:613:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:556:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:26:in `block in call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb:97:in `run_callbacks'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb:24:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/better_errors-2.4.0/lib/better_errors/middleware.rb:84:in `protected_app_call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/better_errors-2.4.0/lib/better_errors/middleware.rb:79:in `better_errors_call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/better_errors-2.4.0/lib/better_errors/middleware.rb:57:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/web-console-3.5.1/lib/web_console/middleware.rb:135:in `call_app'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/web-console-3.5.1/lib/web_console/middleware.rb:28:in `block in call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/web-console-3.5.1/lib/web_console/middleware.rb:18:in `catch'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/web-console-3.5.1/lib/web_console/middleware.rb:18:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:36:in `call_app'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:24:in `block in call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb:69:in `block in tagged'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb:69:in `tagged'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/rack/logger.rb:24:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb:25:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/method_override.rb:22:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/runtime.rb:22:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb:125:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rack-2.0.3/lib/rack/sendfile.rb:111:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/railties-5.1.4/lib/rails/engine.rb:522:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.10.0/lib/puma/configuration.rb:225:in `call'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:605:in `handle_request'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:437:in `process_client'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.10.0/lib/puma/server.rb:301:in `block in run'
/Users/fumihumi/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/puma-3.10.

と、こんなエラーが吐かれてしまった。。。。。。。。。。 なぜだ。。。。。rails4系では問題なくみれていたのだが、、、、

解決はしていないが、対処方法としては rails server のパラメータを頑張って読んで、そこから必要なデータを読み解くしかない?w

あとは rails dashboardとかを利用して出力結果をパースするか。

fumihumi.hatenablog.com

ちなみにrails dashboardを使うとこんな感じになる

  authenticity_token : Aevh******************sAoM/AZRL*********************GHAW06V+==
              commit : ????????
             product : Object
     product[detail] : test message
       product[name] : 1039
      product[price] : 50000
     product[status] : excellent
                utf8 : ✓

おそらくrails5系からセキュリティ面の考慮が入りこの仕様になったのだと思うが、、、にしてもめんどくさい。。。。。。。 なにかいい方法はないのだろうか?

追記:デバッグ用のgemのどれかが悪さをしているっぽい。

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
  gem 'pry-rails'    # rails cの対話式コンソールがirbの代わりにリッチなpryになる
  # gem 'pry-doc'      # pry中に show-source [method名] でソース内を読める
  # gem 'pry-byebug'   # binding.pryをソースに記載すると、ブレイクポイントとなりデバッグが可能になる
  # gem 'pry-stack_explorer' # pry中にスタックを上がったり下がったり行き来できる

  # gem 'hirb'         # モデルの出力結果を表形式で表示する
  # gem 'hirb-unicode' # hirbの日本語などマルチバイト文字の出力時の出力結果がすれる問題に対応
  # gem 'rails-flog', require: 'flog' # HashとSQLのログを見やすく整形
  gem 'better_errors'     # 開発中のエラー画面をリッチにする
  # gem 'binding_of_caller' # 開発中のエラー画面にさらに変数の値を表示する
  # gem 'awesome_print'     # Rubyオブジェクトに色をつけて表示して見やすくなる
end

もともと利用していた、gemをコメントアウトしたら一応動くようになった。。。。