From ae73637e35db20d0c4e14959d8c1274e5399278e Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Fri, 5 May 2017 18:07:12 +0930 Subject: Clarify deprecation message for #quoted_id In this case, it's the method definition that's more at fault, rather than the current caller. --- .../lib/active_record/connection_adapters/abstract/quoting.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb index f0c0fbab6c..61233dcc51 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb @@ -10,8 +10,15 @@ module ActiveRecord value = id_value_for_database(value) if value.is_a?(Base) if value.respond_to?(:quoted_id) + at = value.method(:quoted_id).source_location + at &&= " at %s:%d" % at + + owner = value.method(:quoted_id).owner.to_s + klass = value.class.to_s + klass += "(#{owner})" unless owner == klass + ActiveSupport::Deprecation.warn \ - "Using #quoted_id is deprecated and will be removed in Rails 5.2." + "Defining #quoted_id is deprecated and will be ignored in Rails 5.2. (defined on #{klass}#{at})" return value.quoted_id end -- cgit v1.2.3