Skip to content

Commit

Permalink
Correct caller tracking in delegated deprecation methods
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewd committed Oct 2, 2016
1 parent 7b63f56 commit 62ed561
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions activesupport/lib/active_support/deprecation/instance_delegator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Deprecation
module InstanceDelegator # :nodoc:
def self.included(base)
base.extend(ClassMethods)
base.singleton_class.prepend(OverrideDelegators)
base.public_class_method :new
end

Expand All @@ -19,6 +20,18 @@ def method_added(method_name)
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

0 comments on commit 62ed561

Please sign in to comment.