diff options
author | Matthew Draper <matthew@trebex.net> | 2016-10-05 05:23:20 +1030 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-05 05:23:20 +1030 |
commit | 6ecb14715e4d5acb06c282b96b795404e25c7a11 (patch) | |
tree | 06506865e55f6691855a6ccaea88e7c395501123 /activesupport | |
parent | 0fc115724b87f7b4c990dc26d8b42f48ae72dfeb (diff) | |
parent | 62ed56135be5fd9567fab6647fc588b234a96e04 (diff) | |
download | rails-6ecb14715e4d5acb06c282b96b795404e25c7a11.tar.gz rails-6ecb14715e4d5acb06c282b96b795404e25c7a11.tar.bz2 rails-6ecb14715e4d5acb06c282b96b795404e25c7a11.zip |
Merge pull request #26686 from matthewd/deprecation-caller
Correct caller tracking in delegated deprecation methods
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/deprecation/instance_delegator.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/deprecation/instance_delegator.rb b/activesupport/lib/active_support/deprecation/instance_delegator.rb index 8efa6aabdc..6d390f3b37 100644 --- a/activesupport/lib/active_support/deprecation/instance_delegator.rb +++ b/activesupport/lib/active_support/deprecation/instance_delegator.rb @@ -6,6 +6,7 @@ module ActiveSupport module InstanceDelegator # :nodoc: def self.included(base) base.extend(ClassMethods) + base.singleton_class.prepend(OverrideDelegators) base.public_class_method :new end @@ -19,6 +20,18 @@ module ActiveSupport singleton_class.delegate(method_name, to: :instance) 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 |