mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Correct caller tracking in delegated deprecation methods
This commit is contained in:
parent
7b63f56ce0
commit
62ed56135b
1 changed files with 13 additions and 0 deletions
|
@ -6,6 +6,7 @@ module ActiveSupport
|
||||||
module InstanceDelegator # :nodoc:
|
module InstanceDelegator # :nodoc:
|
||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.extend(ClassMethods)
|
base.extend(ClassMethods)
|
||||||
|
base.singleton_class.prepend(OverrideDelegators)
|
||||||
base.public_class_method :new
|
base.public_class_method :new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -19,6 +20,18 @@ module ActiveSupport
|
||||||
singleton_class.delegate(method_name, to: :instance)
|
singleton_class.delegate(method_name, to: :instance)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module OverrideDelegators # :nodoc:
|
||||||
|
def warn(message = nil, callstack = nil)
|
||||||
|
callstack ||= caller_locations(2)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
|
||||||
|
caller_backtrace ||= caller_locations(2)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue