From 8fa2ecf8ed9db0ce72defdba2c49ba61e701e27d Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Wed, 31 Aug 2016 21:36:37 +0200 Subject: Move to_param undef closer to the deprecations. Makes it clearer why we're doing this Add a comment to elaborate on what the undef means and move it closer to the deprecations so it's less likely for whoever pulls the deprecations that it should go too. --- actionpack/lib/action_controller/metal/strong_parameters.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actionpack/lib/action_controller/metal') diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index f315d93939..dea4657988 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -411,8 +411,6 @@ module ActionController convert_hashes_to_parameters(key, @parameters[key]) end - undef_method :to_param - # Assigns a value to a given +key+. The given key may still get filtered out # when +permit+ is called. def []=(key, value) @@ -622,6 +620,10 @@ module ActionController end end + # Undefine `to_param` such that it gets caught in the `method_missing` + # deprecation cycle below. + undef_method :to_param + def method_missing(method_sym, *args, &block) if @parameters.respond_to?(method_sym) message = <<-DEPRECATE.squish -- cgit v1.2.3