diff options
author | Richard Schneeman <richard.schneeman@gmail.com> | 2016-01-19 13:02:46 -0600 |
---|---|---|
committer | Richard Schneeman <richard.schneeman@gmail.com> | 2016-01-19 13:02:46 -0600 |
commit | ba24d42828283156eba8544113739ce0c14283f0 (patch) | |
tree | 81f51ca8fc4d934b6006caff95ef191295d06d55 /actionpack/lib/action_controller | |
parent | 1347f08521881efacfc42a7284073272affc1d1e (diff) | |
parent | 875a0b6e4f2a5f0b45a38632b4367aa83d995ac3 (diff) | |
download | rails-ba24d42828283156eba8544113739ce0c14283f0.tar.gz rails-ba24d42828283156eba8544113739ce0c14283f0.tar.bz2 rails-ba24d42828283156eba8544113739ce0c14283f0.zip |
Merge pull request #23123 from schneems/schneems/strong_params_method_missing
[close #23084] Deprecated StrongParameters
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index 5cbf4157a4..e9aa0aae37 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -109,7 +109,7 @@ module ActionController cattr_accessor :permit_all_parameters, instance_accessor: false cattr_accessor :action_on_unpermitted_parameters, instance_accessor: false - delegate :keys, :key?, :has_key?, :empty?, :include?, :inspect, + delegate :keys, :key?, :has_key?, :values, :has_value?, :value?, :empty?, :include?, :inspect, :as_json, to: :@parameters # By default, never raise an UnpermittedParameters exception if these @@ -580,6 +580,24 @@ module ActionController dup end + def method_missing(method_sym, *args, &block) + if @parameters.respond_to?(method_sym) + message = <<-DEPRECATE.squish + Method #{ method_sym } is deprecated and will be removed in Rails 5.1, + as `ActionController::Parameters` no longer inherits from + hash. Using this deprecated behavior exposes potential security + problems. If you continue to use this method you may be creating + a security vulunerability in your app that can be exploited. Instead, + consider using one of these documented methods which are not + deprecated: http://api.rubyonrails.org/v#{ActionPack.version}/classes/ActionController/Parameters.html + DEPRECATE + ActiveSupport::Deprecation.warn(message) + @parameters.public_send(method_sym, *args, &block) + else + super + end + end + protected def permitted=(new_permitted) @permitted = new_permitted |