From 23ffd03ede9b27a6cbc3154aa99c247b718ccdbc Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Thu, 13 Mar 2014 11:49:00 -0700 Subject: add the deprecation to adequate record too --- activerecord/lib/active_record/core.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/core.rb b/activerecord/lib/active_record/core.rb index 7d81934526..73ca468d80 100644 --- a/activerecord/lib/active_record/core.rb +++ b/activerecord/lib/active_record/core.rb @@ -128,7 +128,11 @@ module ActiveRecord ids.first.kind_of?(Array) id = ids.first - id = id.id if ActiveRecord::Base === id + if ActiveRecord::Base === id + id = id.id + ActiveSupport::Deprecation.warn "You are passing an instance of ActiveRecord::Base to `find`." \ + "Please pass the id of the object by calling `.id`" + end key = primary_key s = find_by_statement_cache[key] || find_by_statement_cache.synchronize { -- cgit v1.2.3