Merge pull request #19544 from shuhei/fix-parameters-const-missing

Return super in ActionController::Parameters.const_missing
This commit is contained in:
Xavier Noria 2015-03-28 10:01:25 +01:00
commit 8798788c65
2 changed files with 9 additions and 2 deletions

View File

@ -117,7 +117,7 @@ module ActionController
self.always_permitted_parameters = %w( controller action )
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)
`ActionController::Parameters::NEVER_UNPERMITTED_PARAMS` has been deprecated.
Use `ActionController::Parameters.always_permitted_parameters` instead.

View File

@ -1,5 +1,6 @@
require 'abstract_unit'
require 'action_controller/metal/strong_parameters'
require 'minitest/mock'
class AlwaysPermittedParametersTest < ActiveSupport::TestCase
def setup
@ -14,7 +15,13 @@ class AlwaysPermittedParametersTest < ActiveSupport::TestCase
test "shows deprecations warning on NEVER_UNPERMITTED_PARAMS" 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