diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb index f81a2a02e520457ba8738c97adae9ea2e06f9028..5aff753616d53771b714649ce65ffaf64160c7b4 100644 --- a/activesupport/lib/active_support/deprecation.rb +++ b/activesupport/lib/active_support/deprecation.rb @@ -81,8 +81,12 @@ def initialize(instance, method, var = "@#{method}") end private + def warn(callstack, called, args) + ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", callstack) + end + def method_missing(called, *args, &block) - ActiveSupport::Deprecation.warn("#{@var} is deprecated! Call #{@method}.#{called} instead of #{@var}.#{called}. Args: #{args.inspect}", caller) + warn caller, called, args @instance.__send__(@method).__send__(called, *args, &block) end end