mirror of https://github.com/rails/rails
Remove redundant `parent` method from RESTRICTED_CLASS_METHODS
Previously, `parent` was added as one of the RESTRICTED_CLASS_METHODS as part of a commit (94b7328b08
) in 2014 that stopped Rails `enum`s from being able to redefine important class methods. At the time, Rails monkey-patched `Module` with a `parent` class method that returned a module's containing module if it was nested. However, in October 2020 (167b4153ca
) in Rails 6.1, this method was deprecated in favour of a renamed method `module_parent`. As such, the `parent` method doesn't need to be a restricted class method any more.
This commit is contained in:
parent
2d6b02bad6
commit
f705c39fa4
|
@ -20,7 +20,7 @@ module ActiveRecord
|
|||
include Serialization
|
||||
end
|
||||
|
||||
RESTRICTED_CLASS_METHODS = %w(private public protected allocate new name parent superclass)
|
||||
RESTRICTED_CLASS_METHODS = %w(private public protected allocate new name superclass)
|
||||
|
||||
class GeneratedAttributeMethods < Module # :nodoc:
|
||||
LOCK = Monitor.new
|
||||
|
|
|
@ -535,7 +535,7 @@ class EnumTest < ActiveRecord::TestCase
|
|||
:save, # generates #save!, which conflicts with an AR method
|
||||
:proposed, # same value as an existing enum
|
||||
:public, :private, :protected, # some important methods on Module and Class
|
||||
:name, :parent, :superclass,
|
||||
:name, :superclass,
|
||||
:id # conflicts with AR querying
|
||||
]
|
||||
|
||||
|
|
|
@ -363,7 +363,6 @@ class NamedScopingTest < ActiveRecord::TestCase
|
|||
:protected,
|
||||
:private,
|
||||
:name,
|
||||
:parent,
|
||||
:superclass
|
||||
]
|
||||
|
||||
|
|
Loading…
Reference in New Issue