Skip to content
Browse files

Deprecate raise_on_unfiltered_parameters

  • Loading branch information
rafaelfranca committed Apr 21, 2017
1 parent 604657a commit c6640fb62b10db26004a998d2ece98baede509e5
Showing with 7 additions and 7 deletions.
  1. +3 −7 actionpack/
  2. +4 −0 actionpack/lib/action_controller/railtie.rb
@@ -1,4 +1,4 @@
* Raise exception when calling `to_h` in an unpermitted Parameters.
* Raise exception when calling `to_h` and `to_hash` in an unpermitted Parameters.

Before we returned either an empty hash or only the always permitted parameters
(`:controller` and `:action` by default).
@@ -8,13 +8,9 @@

*Rafael Mendonça França*

* Add `ActionController::Parameters#to_hash` to implicit conversion.
* Deprecate `config.action_controller.raise_on_unfiltered_parameters`.

Now methods that implicit convert objects to a hash will be able to work without
requiring the users to change their implementation.

This method will return a `Hash` instead of a `HashWithIndefirentAccess` to mimic the
same implementation of `HashWithIndefirentAccess#to_hash`.
This option has no effect in Rails 5.1.

*Rafael Mendonça França*

@@ -22,6 +22,10 @@ class Railtie < Rails::Railtie #:nodoc:
initializer "action_controller.parameters_config" do |app|
options = app.config.action_controller

if options.delete(:raise_on_unfiltered_parameters)
ActiveSupport::Deprecation.warn("raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.")

ActionController::Parameters.permit_all_parameters = options.delete(:permit_all_parameters) { false }
if app.config.action_controller[:always_permitted_parameters]
ActionController::Parameters.always_permitted_parameters =

0 comments on commit c6640fb

Please sign in to comment.
You can’t perform that action at this time.