mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #19544 from shuhei/fix-parameters-const-missing
Return super in ActionController::Parameters.const_missing
This commit is contained in:
commit
8798788c65
2 changed files with 9 additions and 2 deletions
|
@ -117,7 +117,7 @@ module ActionController
|
||||||
self.always_permitted_parameters = %w( controller action )
|
self.always_permitted_parameters = %w( controller action )
|
||||||
|
|
||||||
def self.const_missing(const_name)
|
def self.const_missing(const_name)
|
||||||
super unless const_name == :NEVER_UNPERMITTED_PARAMS
|
return super unless const_name == :NEVER_UNPERMITTED_PARAMS
|
||||||
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
||||||
`ActionController::Parameters::NEVER_UNPERMITTED_PARAMS` has been deprecated.
|
`ActionController::Parameters::NEVER_UNPERMITTED_PARAMS` has been deprecated.
|
||||||
Use `ActionController::Parameters.always_permitted_parameters` instead.
|
Use `ActionController::Parameters.always_permitted_parameters` instead.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
require 'abstract_unit'
|
require 'abstract_unit'
|
||||||
require 'action_controller/metal/strong_parameters'
|
require 'action_controller/metal/strong_parameters'
|
||||||
|
require 'minitest/mock'
|
||||||
|
|
||||||
class AlwaysPermittedParametersTest < ActiveSupport::TestCase
|
class AlwaysPermittedParametersTest < ActiveSupport::TestCase
|
||||||
def setup
|
def setup
|
||||||
|
@ -14,7 +15,13 @@ class AlwaysPermittedParametersTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
test "shows deprecations warning on NEVER_UNPERMITTED_PARAMS" do
|
test "shows deprecations warning on NEVER_UNPERMITTED_PARAMS" do
|
||||||
assert_deprecated do
|
assert_deprecated do
|
||||||
ActionController::Parameters::NEVER_UNPERMITTED_PARAMS
|
ActionController::Parameters::NEVER_UNPERMITTED_PARAMS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
test "returns super on missing constant other than NEVER_UNPERMITTED_PARAMS" do
|
||||||
|
ActionController::Parameters.superclass.stub :const_missing, "super" do
|
||||||
|
assert_equal "super", ActionController::Parameters::NON_EXISTING_CONSTANT
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue